Carousel, Slider and Thumbnail Push
Step 1: Create a New Notification Content Extension
To create a new Notification Content Extension to your application:
On Xcode click File > New > Target and choose Notification Content Extension.
New class named
NotificationViewControllerwill be created. It should be extended fromNetmeraNotificationContentExtensionclass. YourNotificationContentclass should look like the following:
import UserNotifications
import UserNotificationsUI
import NetmeraNotificationContentExtension
class NotificationViewController: NotificationContentExtension {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceive(_ notification: UNNotification) {
super.didReceive(notification)
}
}Enable Capabilities > App Groups for both your application and
NotificationContentextension.Add
bundle_identifier.group_nameto your app groups.
Optional: Installing Notification Content Extension Using CocoaPods
If you're using a Podfile for dependency management, follow these steps along with the rest of the steps from 1 to 5:
Install
NetmeraNotificationContentExtensionin your Podfile,Install it to your extension target.
pod "NetmeraNotificationContentExtension"Note: If you're not using CocoaPods, you can skip this step.
Step 2: Add Your AppGroupName
AppGroupNameAdd your
AppGroupNamein your Netmera-Config.plist.
<key>sdk_params</key>
<dict>
<key>app_group_name</key> // add this line in Config.plist
<string>{YourAppGroupName}</string> // add this line in Config.plist
<key>use_ui_scene</key>
<false/>
<key>api_key</key>
<string>{API_KEY}</string>
<key>custom_events</key>
<array>
<string>{YourCustomEvent}</string>
</array>
</dict>If you don't have a Netmera-Config.plist see the step here 1. Configure with Netmera Plist.
Step 3: Select Targets in Target Membership
Select all three targets in the Target Membership section on the right.

Step 4: Select Main Project & Content Extension
Go to Notification View Controller > Target Membership.
Select both the main project and the content extension.

Step 5: Info.plist Settings
Sample Content Extention Info.plist
<?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>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>UNNotificationExtensionUserInteractionEnabled</key>
<true/>
<key>UNNotificationExtensionCategory</key>
<array>
<string>NetmeraCarousel</string>
<string>NetmeraGeneral</string>
</array>
<key>UNNotificationExtensionInitialContentSizeRatio</key>
<real>1</real>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.usernotifications.content-extension</string>
</dict>
</dict>
</plist>1. Receiving Http Media Contents
If you want to allow your application to receive http media contents follow these steps:
Click
Info.plistunder Notification Content Extension,Add App Transport Security Settings,
Add Allow Arbitrary Loads under App Transport Security Settings and set it to YES.
2. Enabling Slides in Carousel Notifications
To allow users to slide between multiple media items (such as images) in a notification:
Set
UNNotificationExtensionUserInteractionEnabledto YES.Add
UNNotificationExtensionCategoryas an array in Info.plist and include:NetmeraGeneralNetmeraCarousel(enables sliding between multiple media items)

Troubleshooting
If push notifications do not display correctly:
Go to Build Settings > Runpath Search Paths in the extension target. Ensure the following paths are added:
@executable_path/../../Frameworks
@executable_path/Frameworks
@loader_path/FrameworksRemove the default label in MainInterface.
Last updated
Was this helpful?