> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fyno.io/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fyno.io/docs/_mcp/server.

# Flutter - IOS specific configuration

> Configure Apple APNs capabilities, implement required AppDelegate hooks, and provision a Notification Service Extension inside Xcode to enable rich push processing for your Flutter application.

To enable push notifications for iOS, you need to configure specific capabilities and handle the necessary app delegate code. Let's walk through the steps.

### Update iOS pods

Run `pod install` in the ios folder of your flutter application to install/update the pod dependencies.

### Add capabilities in iOS application

1. Open your Flutter project in Xcode.

2. Inside the **Targets** section, select your app target, and go to **Signing & Capabilities**.

3. Click on **+ Capability** and add **Push Notifications** and **Background Modes** capabilities.
   ![](/docs/_fern-img/b07197bd5747b13db3c5d92dc01bb83e27db569c52b297b230c6d8dbdd0a78cc.webp)
   ![](/docs/_fern-img/9941335ebf01ee95bd9aaefa9ffe581cd92643e2d1be85103218b0055f6fe4f1.webp)

4. In Background Modes, select the Remote Notifications option. This is required to receive background push notifications. Learn more about background notifications [here](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app).
   ![](/docs/_fern-img/bf1d2342af83afd1d92e3dc5e9edddbe8be27112f63e2f555c680d91a2d66105.webp)

### Register for push notification in AppDelegate.swift file

To handle push notifications in your iOS app, add the following code to `AppDelegate.swift`:

1. Import the required packages:

**`AppDelegate.swift`**

```swift title="AppDelegate.swift" wordWrap
import UIKit
import Flutter
import fyno_push_ios
```

2. If you are using Firebase Cloud Messaging (FCM), add the Firebase imports:

**`AppDelegate.swift`**

```swift title="AppDelegate.swift" wordWrap
import FirebaseCore
import FirebaseMessaging
```

3. Extend `FlutterAppDelegate` and implement the necessary methods:

**`AppDelegate.swift`**

```swift title="AppDelegate.swift" wordWrap
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
    let fynosdk = fyno.app

    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        GeneratedPluginRegistrant.register(with: self)

        UNUserNotificationCenter.current().delegate = fynosdk

        self.fynosdk.registerForRemoteNotifications()

        fynosdk.requestNotificationAuthorization { _ in }

        FirebaseApp.configure() // Optional: Configure Firebase if FCM is used

        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }

    override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
        print("Failed to register for remote notifications: \(error.localizedDescription)")
    }

    override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        fynosdk.setdeviceToken(deviceToken: deviceToken)

      	Messaging.messaging().apnsToken = deviceToken // Optional: Set APNs token for FCM
    }
}
```

### Add a Notification Service Extension

To ensure rich push notifications and proper handling of incoming messages, add a `Notification Service Extension` to your iOS project:

1. In Xcode go to **File** > **New** > **Target**.

2. Select `Notification Service Extension` from the template list.

3. Provide a product name, select your development team, choose Swift as the language, and click Finish.
   ![](/docs/_fern-img/92630a28cf4d0752f8abc1ed64d05ca481271f8123b573806fc4ed24dcd6790c.webp)
   ![](/docs/_fern-img/d821f8e0a40ab13c4783f1494bd29e26c9e947217c95469f3ac5f927c7da1c3f.webp)

4. Replace the contents of the generated `NotificationService.swift` file with the following code:

**`NotificationService.swift`**

```swift title="NotificationService.swift" wordWrap
import UserNotifications
import UIKit
import fyno

class NotificationService: UNNotificationServiceExtension {
    var contentHandler: ((UNNotificationContent) -> Void)?
    var bestAttemptContent: UNMutableNotificationContent?

    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
        fyno.app.handleDidReceive(request, withContentHandler: contentHandler)
    }

    override func serviceExtensionTimeWillExpire() {
        if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
            contentHandler(bestAttemptContent)
        }
    }
}
```

### Add Fyno SDK to the Notification Service Extension

To allow the Notification Service Extension to use the Fyno SDK, you need to import it:

1. In Xcode, select your Notification Service Extension target.

2. Under `Frameworks and Libraries`, click on the **+** button.
   ![](/docs/_fern-img/4cce26d5c8ba1261f89094ffd9824559b257e29bf70d1cd95f9e2f23150c1a49.webp)

3. Under `Add Other`, click on the `Add Package Dependency`.
   ![](/docs/_fern-img/aaa07ea4b31dc9986263368ec5173d68a00aa396d4f45434a82a07302438981c.webp)

4. Search for `https://github.com/fynoio/ios-sdk` in the text box.

5. Select and add the `ios-sdk` package.
   ![](/docs/_fern-img/6603d6a9dd1a52cfda7656f5732557dd58bb6c81b0888dc376ea3d1e69807ca9.webp)

6. Ensure the target is set to the Notification Service Extension you created, then click `Add Package`.
   ![](/docs/_fern-img/6bc395a2611392af878e198f927d9766fde40984df09ded6570c91ea74ef8667.webp)

> **Success**
>
> You have successfully integrated Fyno's Flutter Push Notification SDK into your application. Go ahead and test the integration by sending a push notification using [Notification Events](./events-overview)