Carousel, Slider and Thumbnail Push

Warning:

You should build your application with Xcode 8 or higher to use iOS10 media push on your application.

Step 1: Create New Target

Make sure you have Xcode 8 or a higher version installed. If not, upgrade your Xcode installation to use iOS10 media push on your application.

First you should create a new Notification Content Extension to your application. In order to do that, you should Follow those steps:

  • Open Xcode and navigate to File -> New -> Target

  • Choose Notification Content Extension frrom the available options.

  • After you selected Notification Content Extension new class named NotificationViewController will be created. It should be extended from NetmeraNotificationContentExtension class.

Switching Back to Debugging

If you accidentally "Activate", you can return to debugging your app using Xcode, which is located alongside the play button.

Step 2: Add your Project to Pod File

Remove the Objective-C Bridging Header file from the project and add:

NetmeraNotificationContentExtension in the NotificationContent.swift file.

Link the Netmera.framework to the Notification Content Extension. Add the Notification Content Extension as a new target in your Podfile by including the following lines,

target 'your_content_extension_target_name' do

  pod "Netmera/NotificationContentExtension"

end

Warning:

After adding the previous line to your Podfile, pod update is used.

Step 3: Add Codes to Notification Service Extension Class

A new class named "NotificationContent" will be created, which should be extended from the NetmeraNotificationContentExtension class. Your NotificationContent class should look like the following.

class NotificationViewController: NetmeraNotificationContentExtension {
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any required interface initialization here.
    }
}

Step 4: Info.plist Configuration

To configure the Info.plist file for the content extension and enable App Groups, follow these steps:

  1. Make sure the info.plist file under the content extension looks like this.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>AppGroupName</key> <string>your group name</string>

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>UNNotificationExtensionCategory</key>
            <array>
                <string>NetmeraGeneral</string>
                <string>NetmeraCarousel</string>
            </array>
            <key>UNNotificationExtensionInitialContentSizeRatio</key>
            <integer>1</integer>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.usernotifications.content-extension</string>
    </dict>
</dict>
</plist>
  1. Delete Label in MainInterface

  2. Enable App Groups for both your application and the NotificationContent extension in the Capabilities settings of your project. Then add "group.com.yourcompany.carousel" to your app groups.

  3. Once you have added the app groups to your app, you need to specify the app group name in the app delegate method where you set the Netmera.start() method. Use the following code as an example,

Netmera.setAppGroupName = "group.com.yourcompany.carousel"

Completed

The integration process for Carousel, Slider, and Thumbnail Push has been successfully completed, and you are now ready to commence testing and further enhancements.

Last updated