iOS 10 introduced support for rich notifications, which added the ability to send push notifications with media attachments such as images, animated gifs, sounds and videos.
It is a very interesting way to enhance the User Experience and the performance of your Push Notifications.
Here it is an example of push notification with a media attachment :
Rich notifications are available on iPhone 5s or later, iPad Pro, iPad Air or later, and iPad mini 2 or later.
To enable this functionality, you will need to create a Notification Service Extension.
By default, XCode set the most recent iOS version available as deployment target. If you run your application on a device that has an older iOS version, push notifications with media attachment won't be able to work. We recommend to set 10.0 as deployment target.
In your Podfile, add the pod Accengage-iOS-SDK-Extension to your newly created target
Then, update your Cocoapods project.
- Once your notification service is created, download and unzip the latest version of the iOS SDK Extension.
AccengageExtension.frameworkinto the top level of your Xcode project. When prompted, use the checkboxes to add the framework to the notification service target. Make sure you check the Copy items if needed box.
- In your application target you need to add a Copy Files build phase to your target. From the Build Phases panel of your target's configuration:
- Press the
+button from the top left region
New Copy Files Phase. A new entry will appear in the Build Phases list.
- Change the destination selector to
- Find the
AccengageExtension.frameworkand drag it into this new section.
- Press the
The order of the build phases is important. The Run Script phase must be added after (or placed below) the Copy Files phase.
Link Frameworks Automaticallyare enabled in the target Build Settings.
Finally, inherit from
ACCNotificationServiceExtensionin NotificationService and replace all the code generated by XCode by the following one :