Overview

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.

Prerequisites

None.

Step-by-step

  1. Set a Target in your XCode project.

    In your XCode project, go to the File menu and select New > Target. A dialog box opens.

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

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

    Note:
    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.”

    and

    ERROR ITMS-90206: “Invalid Bundle. The bundle at ‘Name.appex’ contains disallowed file ‘Frameworks’.”

     

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

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

  6. Add -ObjC to the Other Linker Flags build options for the Notification Service

Expected outcome

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.

Join The Discussion

Your email address will not be published. Required fields are marked *