Links

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.
Swift
Objective-C
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

To configure the Info.plist file for the content extension and enable App Groups, follow these steps:
  1. 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. 2.
    Delete Label in MainInterface
  2. 3.
    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. 4.
    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,
Swift
Objective-C
Netmera.setAppGroupName = "group.com.yourcompany.carousel"
[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.