SDK Integration

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

We send push notifications using APNS (Apple Push Notification Service). Therefore, you need to obtain an Apple Push Notification Certificate from www.developer.apple.com using 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.

Creating an APNS .p12 Certificate

Step 2: Integrate SDK into Your Project

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

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. Access the Netmera SDK by downloading the framework.zip file from this link: Download Netmera SDK

  2. 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.

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.

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()

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

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 Troubleshooting Push Notifications.

Last updated

Was this helpful?