Configure the Flutter Plugin for iOS Apps

After you install and configure the Flutter plugin for the Salesforce Engagement SDK, configure the plugin to enable push support for the iOS platform.

Install the dependencies for the SDK. See Integrate the SDK for iOS.

Install the Flutter plugin. See Marketing Cloud Flutter Plugin.

Enable push notifications in the Capabilities settings for your target in Xcode.

Enable Push

  1. Navigate to the YOUR_APP/ios directory and open Runner.xcworkspace.

  2. To configure the SDK and enable push, update AppDelegate.

View Swift code example
View Objective-C code example

The SDK doesn’t automatically present URLs from these sources.

  • CloudPages URLs from push notifications
  • OpenDirect URLs from push notifications
  • Action URLs from in-app messages

To handle URLs from push notifications, follow these steps.

  1. Set the setURLHandlingDelegate.
  2. Implement the URLHandlingDelegate.

To set the URLHandlingDelegate, update the AppDelegate as shown in this example.

View Swift code example
View Objective-C code example

Implement the URLHandlingDelegate in AppDelegate, as shown in this example.

View Swift code example
View Objective-C code example

Rich notifications include images, videos, titles, subtitles, and mutable content. Mutable content can include personalization in the title, subtitle, or body of your message.

For implementation details, see Send Rich Notifications.

If you encounter a cycle error in your Flutter Xcode project after adding a Notification Service Extension, follow these steps to fix it.

  1. Navigate to YOUR_APP_TARGET in Xcode.
  2. With your app target selected, go to the Build Phases tab.
  3. Find Embed Foundation Extension.
  4. Drag and position it above both Thin Binary and Embed Pods Frameworks.

Reordering the build phases resolves the cycle error.