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 New Target
  • Step 2: Add your Project to Pod File
  • Step 3: Add Code to Notification Content Extension Class
  • Step 4: Info.plist Configuration

Was this helpful?

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

Carousel, Slider and Thumbnail Push

PreviousMedia PushNextCustom Web View Presentation

Last updated 2 months ago

Was this helpful?

Warning:

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

Step 1: Create New Target

  1. Ensure Xcode 8 or higher is installed.

  2. In Xcode: Navigate to File > New > Target.

  1. Select Notification Content Extension.

  1. A new class named NotificationViewController will be created. Extend it from NetmeraNotificationContentExtension.

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

  1. Remove the Objective-C Bridging Header file.

  2. Add NetmeraNotificationContentExtension in the NotificationContent.swift file.

  3. In your Podfile, add:

target 'your_content_extension_target_name' do
  pod "Netmera/NotificationContentExtension"
end
  1. Run pod update to apply the changes.

Warning: Run pod update after editing the Podfile.

Step 3: Add Code to Notification Content Extension Class

  1. The new NotificationViewController class should extend NetmeraNotificationContentExtension

class NotificationViewController: NetmeraNotificationContentExtension {
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any required interface initialization here.
    }
}
#import <UIKit/UIKit.h>
#import <NetmeraNotificationContentExtension/NetmeraNotificationContentExtension.h>

@interface NotificationViewController : NetmeraNotificationContentExtension

@end
#import "NotificationViewController.h"
#import <UserNotifications/UserNotifications.h>
#import <UserNotificationsUI/UserNotificationsUI.h>

@interface NotificationViewController ()

@end

@implementation NotificationViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  // If you want to change the background color, uncomment the next line
  // self.view.backgroundColor = [UIColor whiteColor];
}

@end

Step 4: Info.plist Configuration

  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. If you want to add slide action to Carousel property, UserInteractionEnabled must be set YES.

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

  2. Specify the app group name in the app delegate method where you set the Netmera.start() method. Use the following codes as examples:

Netmera.setAppGroupName = "group.com.yourcompany.carousel"
[Netmera setAppGroupName:@"group.com.yourcompany.carousel"];