Skill Level: Intermediate
The Mobile app messaging SDK for iOS supports media attachments in notifications for iOS 10 (and later) applications. When a user on a iOS 10 device receives a notification with a media attachment from the APNS service, the incoming notification is processed before it is displayed to the user. First, the URL for the media attachment is extracted, and then the media file is downloaded and attached to the notification.
Dynamic action categories are created in real-time by the SDK when a special payload is received and background processing is enabled for the app. They are defined in the â€ścategory-actionsâ€ť section of the payload and include standard actions. You can use them with custom actions that you define by overriding those two predefined actions. The specific action is chosen by supplying a â€śtypeâ€ť key in either the â€śnotification-actionâ€ť or â€ścategory-actionsâ€ť payload.
Note: Media attachments are not supported in Xamarin for iOS.
Set a Target in your XCode project.
In your XCode project, go to the File menu and select New > Target. A dialog box opens.
Set the target to iOS.
In the dialog box, select iOS at the top and Notification Service Extension in the center of the window. The new target is added to the XCode project.
Add the framework to the notification service target.
Drag AcousticMobilePushNotification.xcframework from the sdk folder into the project’s frameworks (the Embed Frameworks Build Phase of the containing iOS application)
If the AcousticMobilePushNotification.xcframework is on the Notification Service Extension’s General tab, the automated App Store review, while the app is being uploaded, will throw the following errors:
ERROR ITMS-90205: “Invalid Bundle. The bundle at ‘Name.appex’ contains disallowed nested bundles.”
ERROR ITMS-90206: “Invalid Bundle. The bundle at ‘Name.appex’ contains disallowed file ‘Frameworks’.”
Remove methods and change the superclass in the provided MCENotificationService class.
Remove methods in the UNNotificationServiceExtension subclass and change the superclass to the provided MCENotificationService class.
Add the MceConfig.json file to the Notification Service target
Open the MceConfig.json file and check the Notification Service target membership in the Target Membership of the File Inspector in the right Xcode pane.
Add -ObjC to the Other Linker Flags build options for the Notification Service
To add media attachments to notifications, you must configure the mutable-content flag and media-attachment key in the iOS 10 payload. For more information, refer to the following articles:
For information about other mobile app messages features, see the Documentation.
Go Back to Mobile App Messaging home page.