iOS Notification service for Flutter

Implement the iOS notification service by adding the AcousticMobilePushNotification.xcframework to your App. The AcousticMobilePushNotification.xcframework enables support for media attachments (images, audio, and video).

  1. Download and unzip a version of the iOS SDK.
  2. Open your project and the iOS folder in Visual Studio Code.
  3. Right-click on Runner.xcworkspace file and select Reveal in finder.
  4. Then open the Runner.xcworkspace file with Xcode.
  5. Add the Notification Service by selecting Runner, then go to the File menu and select New > Target.
  6. In the dialog box, select iOS at the top and the Notification Service Extension for the Application Extension.
  7. Click Next, and a new dialog box opens. Update the following:
    a. Add the Product Name for your new target. For example, NotificationService.
    b. Choose a language. For example, Swift.
    c. Select your project and the application in which you would like to embed the new target.
    d. Click Finish to add your new target.
  8. A new dialog appears asking you to activate a new scheme for the Notification Service target. Click Activate. The following are added to your project:
    a. A new folder on your project navigator with the Notification Service code.
    b. A new Notification ServiceTarget on your main project.
  9. Drag and drop the AcousticMobilePushNotification.xcframework from the unzipped folder to your Notification Service Target's Frameworks and libraries in the General tab.
  10. In the Signing & Capabilities tab, add two new capabilities to your Notification Service Target:
    a. Add the App Group capability to your notification service extension target. Be sure to use the same app group as the main application.
    b. Add the Keychain Sharing capability to your notification service extension target. Be sure to use the same value as the main application.
  11. In the Build Settings tab, check that the Other Linker Flags property is set to -ObjC on your Notification Service target.
  12. From the main application, select the MCEConfig.json file and add your new Notification Service Target to their Target Membership.
  13. Since the main project is configured manually using the Config.xml file, you must also manually configure your new Notification Service Extension.
  14. Apply the following changes to your Notification Service swift file:
    a. Import the AcousticMobilePushNotification framework: import AcousticMobilePushNotification
    b. Remove all the methods from the NotificationService class. Instead of subclassing from UNNotificationServiceExtension, use MCENotificationService.
  15. Check the NotificationService.swift file for the following references:
import UserNotifications
import AcousticMobilePushNotification
    
class NotificationService: MCENotificationService {}

Did this page help you?