Netmera Developer Guide
Netmera Docs
  • Netmera Developer Guide
  • Platforms
    • iOS
      • New iOS (Swift)
        • SDK Integration
        • Push Notifications
          • Delegate Methods
          • Widget and In-App Messages
          • Media Push
          • Carousel, Slider and Thumbnail Push
        • Deep Linking
          • Custom Deep Links
        • Sound & Vibration
        • Push Inbox
        • Events
        • Geofence & Location
        • User Attributes & Preferences
        • Advertising ID
        • Changelog
      • Former iOS (Objective-C)
        • SDK Integration
        • Push Notifications
          • Delegate Methods
          • Push Payload Receivers
          • Widget and In-App Messages
          • Customizing In-App Messages
          • Media Push
          • Carousel, Slider and Thumbnail Push
          • Custom Web View Presentation
          • Push Icon
        • Live Activities
        • Deep Linking
          • Custom Deep Links
        • Sound & Vibration
        • Push Inbox
        • Events
        • Geofence & Location
        • User Attributes & Preferences
        • Data Transfer
        • Advertising ID
        • SSL Pinning
        • Changelog
    • Android
      • SDK Integration
        • Huawei Integration
        • Huawei Message Receipt
        • Android Integration FAQs
      • Push Notifications
        • Widget and In-App Messages
        • Push Callbacks
        • Custom Web View Presentation
        • Push Icon
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
        • Background Location Permission
      • User & Attributes
      • Data Transfer
      • Advertising ID
      • App Tracking
      • SSL Pinning
      • Changelog
    • Web
      • SDK Setup
        • Self-Hosted SDK Setup
      • Mobile Web Push for iOS
      • Deep Linking
        • Custom Deep Links
      • Events
      • User & Attributes
    • React Native
      • SDK Integration
      • Push Notifications
        • Widget and In-App Messages
        • Push Callbacks
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
      • User & Attributes
      • Changelog
    • Flutter
      • SDK Integration
      • Push Notifications
        • Push Notification Permissions
        • Widget and In-App Messages
        • Flutter iOS Media Push
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
      • User & Attributes
      • SSL Pinning
      • Changelog
    • Cordova
      • SDK Integration
      • Push Notifications
      • Sound & Vibration
      • Push Inbox
      • Events
      • User & Attributes
    • Unity
      • SDK Integration
      • Sound & Vibration
      • Events
      • User & Attributes
      • Changelog
  • Integrated Modules
    • Optimove
    • Adjust
    • Mixpanel
    • IYS Integration
    • VIA Integration
      • Short URL Consent Requests
      • OTP Consent Requests
        • OTP Confirmation Completion
      • VIA Email Rejection Link Generation
      • ETK Rejection via SMS
  • API Documentation
    • REST API
      • Setup
      • Notifications
      • Events
      • User & Device Management
      • Inbox Feature
      • GDPR
      • Error Responses
  • FAQs
    • Push Notifications FAQs
Powered by GitBook
On this page
  • Onboarding Checklist: iOS
  • Video Guide: Netmera iOS Integration Guide
  • Step 1: Create an Apple Push Notification Certificate
  • Creating an APNS .p8 Certificate (Recommended)
  • Creating an APNS .p12 Certificate
  • Step 2: Integrate SDK into Your Project
  • Integration with CocoaPods
  • iOS SDK Manual Integration (optional)
  • Step 3: Setup Netmera
  • Step 4: Request Push Notification Authorization
  • Check Notification Authorization Status
  • Step 5: Configure Xcode Push Notifications Settings
  • iOS SDK Integration Complete
  • Troubleshooting

Was this helpful?

  1. Platforms
  2. iOS
  3. Former iOS (Objective-C)

SDK Integration

PreviousFormer iOS (Objective-C)NextPush Notifications

Last updated 29 days ago

Was this helpful?

Important Information:

We strongly recommend you to integrate with our new Swift SDK by referring to the guide on SDK Integration for incorporating Netmera into your projects.

The previous iOS SDK integration method, which you can find here, is being phased out and will not be supported in the long term. Transitioning to the new SDK will ensure that you have access to the latest features, improvements, and technical support.

Onboarding Checklist: iOS

Please find the Onboarding Checklist for iOS and Android below. Follow the titles in the checklist to ensure you have completed each essential step in your onboarding process with Netmera.

Video Guide: Netmera iOS Integration Guide

Step 1: Create an Apple Push Notification Certificate

Creating an APNS .p8 Certificate (Recommended)

Using the APNS .p8 certificate is highly recommended for the following reasons:

  1. The .p8 certificate is mandatory for enabling features such as Live Activities.

  2. Unlike .p12 certificates, a single .p8 certificate can manage push notifications for multiple applications, simplifying certificate management across projects.

  3. The .p8 certificate does not require yearly renewal, reducing administrative overhead compared to .p12 certificates.

  4. The .p8 certificate is easier to generate via the Apple Developer Portal and only needs to be downloaded once.

Creating an APNS .p12 Certificate

Important Notes on Bundle ID:

Make sure to add the certificate generated with the bundle ID of your project to the panel, and set the bundle ID of your project in the panel as well. The bundle ID of your project, the bundle ID of the certificate, and the bundle ID set in the panel should all match.

In case of having problems sending push notifications when you build from Xcode:

Check the certificate type on the Developer > Backend Transfer > iOS page in the menu on the left. If you downloaded the app from the store or are testing it via TestFlight, the certificate type must be "prod". If you are compiling from Xcode, the certificate type must be selected as "dev".

Step 2: Integrate SDK into Your Project

Integration with CocoaPods

  1. Open your project's Podfile. Add the following line to include the Netmera SDK:

pod 'Netmera'

For projects without AdId support, use the following:

pod 'Netmera/NetmeraWithoutAdId'

iOS SDK Manual Integration (optional)

If you choose not to use CocoaPods, you can manually integrate Netmera into your project. Follow the instructions below to complete this process.

Manual Integration Steps

For manual integration of Netmera, please follow these steps:

  1. Add Netmera to your project by selecting the plus sign (+) in the 'Framework, Libraries, and Embedded Content' field within your project's target. Choose the following files:

    • Netmera.xcframework

    • NetmeraAdId.xcframework

    • NetmeraCore.xcframework

  1. Once you've added the frameworks, initialize Netmera by following the steps outlined in our documentation: SDK Integration

  2. For information on Receiver Methods, enabling/disabling Popups and In-App Messages, Media Push, Carousel/Slider, and Thumbnail Push, please refer to this link: Push Notifications

  3. Keep in mind that you'll need to create a service extension for Media Push and a content extension for Carousel/Slider and Thumbnail Push.

  4. After creating the service extension and content extension, add the relevant frameworks as shown in the provided images.

Ensure that the general settings of your project's targets match the configurations depicted in the images.

This manual integration process will help you successfully incorporate Netmera into your iOS project.

Step 3: Setup Netmera

  1. Add the following code to your AppDelegate class.

import UIKit

// Import Netmera framework
import Netmera

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // Start the Netmera instance
        // This must be called before -application:didFinishLaunchingWithOptions: method returns
        Netmera.start()

        // For On-premise setup, use this line:
        // Netmera.setBaseURL("YOUR PANEL DOMAIN URL")

        // Set API Key (this can be called later)
        Netmera.setAPIKey("YOUR_CLIENT_API_KEY")
        
        // Set the desired log level
        Netmera.setLogLevel(NetmeraLogLevel.debug)

        return true
    }
}

Netmera.setLogLevel(NetmeraLogLevel.debug)

This method controls the level of logging for Netmera and is optional based on your requirements. There are three log levels to choose from:

  • debug: Logs detailed information for debugging purposes. Ideal for tracking the flow of events in your app.

  • error: Displays only error logs, helping you focus on issues and errors.

  • none: Disables logging for Netmera, providing a clean output without any Netmera-specific logs.

You can select the appropriate log level according to your development needs. This method is optional and should be used based on whether you want to monitor Netmera's logs.

#import "AppDelegate.h"

// Import Netmera framework
#import <Netmera/Netmera.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  // Start the Netmera instance
  // This must be called before -application:didFinishLaunchingWithOptions: method returns
  [Netmera start];

  // For On-premise setup, use this line:
  // [Netmera setBaseURL:@"YOUR PANEL DOMAIN URL"];

  // Set API Key (this can be called later)
  [Netmera setAPIKey:@"YOUR_SDK_API_KEY"];

  // Set the desired log level
  [Netmera setLogLevel:(NetmeraLogLevelDebug)];

  return YES;
}

@end

Netmera.setLogLevel(NetmeraLogLevel.debug)

This method controls the level of logging for Netmera and is optional based on your requirements. There are three log levels to choose from:

  • debug: Logs detailed information for debugging purposes. Ideal for tracking the flow of events in your app.

  • error: Displays only error logs, helping you focus on issues and errors.

  • none: Disables logging for Netmera, providing a clean output without any Netmera-specific logs.

You can select the appropriate log level according to your development needs. This method is optional and should be used based on whether you want to monitor Netmera's logs.

Important Notes:

  • Make sure to obtain the API key from the relevant panel. To get the YOUR_SDK_API_KEY, navigate to Developers > API > SDK API Key in your web panel.

  • If you're working with an on-premise installation, ensure you call the Netmera.setBaseURL("YOUR PANEL DOMAIN URL") method before setting the API key.

Step 4: Request Push Notification Authorization

  1. To request push notification authorization from the user, call the following method:

// Request authorization for the needed notification types
Netmera.requestPushNotificationAuthorization(forTypes: [.alert, .badge, .sound]) 

Important Notes:

  • Calling this method will immediately trigger the push notification permission dialog to appear to the user.

  • Make sure to call this method after informing the user about how your application will use push notifications.

  • If push permission has already been requested from Apple or another push provider, you should call this method within that request. Otherwise, interactive push buttons will not be handled by the Netmera SDK.

// Request authorization for the needed notification types
[Netmera requestPushNotificationAuthorizationForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound];

Important Notes:

  • Calling this method will immediately trigger the push notification permission dialog to appear to the user.

  • Make sure to call this method after informing the user about how your application will use push notifications.

  • If push permission has already been requested from Apple or another push provider, you should call this method within that request. Otherwise, interactive push buttons will not be handled by the Netmera SDK.

Check Notification Authorization Status

You can use the isEnabled method to determine if the user has granted permission for notifications. This will help you assess whether the push notification functionality is available.

Netmera.isEnabledReceivingPushNotifications()
[Netmera isEnabledReceivingPushNotifications];

Step 5: Configure Xcode Push Notifications Settings

  1. Open your project in Xcode.

  2. Navigate to Signing & Capabilities.

  3. Under Capabilities, add Push Notifications to your app.

This enables the necessary configurations for push notifications in your application.

iOS SDK Integration Complete

iOS SDK integration has been successfully completed, and your devices are now ready to receive the following types of push notifications sent via the Netmera Dashboard:

  • Standard Push Notifications

  • Interactive Push Notifications

  • Widgets

  • Push Notifications with Deeplinks

Troubleshooting

We send push notifications using APNS (Apple Push Notification Service). Therefore, you need to obtain an Apple Push Notification Certificate fromusing your account. Once you have the certificate, you should export it using Keychain Access and add it to the iOS page in the panel's left menu under Developer > Push Backends > iOS.

The preferred method for integrating Netmera into your project is through . CocoaPods simplifies dependency management, making the integration process more efficient. However, if you prefer not to use CocoaPods, manual integration is also an option.

Access the Netmera SDK by downloading the framework.zip file from this link:

If you are sending push notifications from the Netmera Dashboard but not receiving them on your devices, please refer to Apple's Technical Note about .

www.developer.apple.com
CocoaPods
Download Netmera SDK
Troubleshooting Push Notifications
44KB
Netmera Mobile Technical Onboarding Checklist.xlsx