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
  • Step 1: Create a New Notification Content Extension
  • Optional: Installing Notification Content Extension Using CocoaPods
  • Step 2: Add Your AppGroupName
  • Step 3: Select Targets in Target Membership
  • Step 4: Select Main Project & Content Extension
  • Step 5: Info.plist Settings
  • Troubleshooting

Was this helpful?

  1. Platforms
  2. iOS
  3. New iOS (Swift)
  4. Push Notifications

Carousel, Slider and Thumbnail Push

Step 1: Create a New Notification Content Extension

To create a new Notification Content Extension to your application:

  1. On Xcode click File > New > Target and choose Notification Content Extension.

  2. New class named NotificationViewController will be created. It should be extended from NetmeraNotificationContentExtension class. Your NotificationContent class 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)
  }
}
  1. Enable Capabilities > App Groups for both your application and NotificationContent extension.

  2. Add bundle_identifier.group_name to 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 NetmeraNotificationContentExtension in 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

  1. Add your AppGroupName in 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>

Step 3: Select Targets in Target Membership

  1. Select all three targets in the Target Membership section on the right.

Step 4: Select Main Project & Content Extension

  1. Go to Notification View Controller > Target Membership.

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

  1. Click Info.plist under Notification Content Extension,

  2. Add App Transport Security Settings,

  3. 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:

  1. Set UNNotificationExtensionUserInteractionEnabled to YES.

  2. Add UNNotificationExtensionCategory as an array in Info.plist and include:

    • NetmeraGeneral

    • NetmeraCarousel (enables sliding between multiple media items)

The UNNotificationExtensionCategory field does not appear automatically in Info.plist. You must manually enter and configure it.

Troubleshooting

If push notifications do not display correctly:

  1. 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/Frameworks
  1. Remove the default label in MainInterface.

PreviousMedia PushNextDeep Linking

Last updated 2 months ago

Was this helpful?

If you don't have a Netmera-Config.plist see the step here .

1. Configure with Netmera Plist