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

# React Native - IOS specific configuration

> Configure Apple APNs capabilities, implement required Objective-C or Swift AppDelegate hooks, and provision a Notification Service Extension inside Xcode to enable rich push processing for your React Native application.

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

### Update iOS pods

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

### Add capabilities in iOS application

1. Open your React Native 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).

### Register for push notification in the AppDelegate file

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

1. Import the required packages:

#### AppDelegate.mm

```objc
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import <UserNotifications/UserNotifications.h>
#import <fyno/fyno-Swift.h>
```

#### AppDelegate.swift

```swift
import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
import fyno_push_ios
```

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

#### AppDelegate.mm

```objc
#import <FirebaseMessaging/FirebaseMessaging.h>
#import <FirebaseCore/FirebaseCore.h> 
```

#### AppDelegate.swift

```swift
import FirebaseCore
import FirebaseMessaging
```

3. Make the required changes in the AppDelegate file

#### AppDelegate.mm

```objc
@interface AppDelegate () <UNUserNotificationCenterDelegate>
@property (nonatomic, strong) fyno *fynosdk;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  UNUserNotificationCenter.currentNotificationCenter.delegate = self.fynosdk;
  self.fynosdk = [fyno app];
  [self.fynosdk registerForRemoteNotifications];
  ...
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
  NSLog(@"Failed to register for remote notifications: %@", error.localizedDescription);
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  // Send the device token to fynoServer
  [self.fynosdk setdeviceTokenWithDeviceToken:deviceToken];
}

...
```

#### AppDelegate.swift

```swift
class AppDelegate: UIResponder, UIApplicationDelegate {
...

let fynosdk = fyno.app

..
func application(
  _ application: UIApplication,
  didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
  ...
  
  self.fynosdk.registerForRemoteNotifications()
  fynosdk.requestNotificationAuthorization { _ in 
  ...
  
  return true
}

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

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

```

### 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 the appropriate language, and click Finish.

![](/docs/_fern-img/92630a28cf4d0752f8abc1ed64d05ca481271f8123b573806fc4ed24dcd6790c.webp)
![](/docs/_fern-img/3060361cd8d22e91e3eaeb22529a23bd50644055fbc32a2d1c75bf98b37bcadf.webp)

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

#### NotificationService.m

```objc
#import "NotificationService.h"
#import <fyno/fyno-Swift.h>
#import <FirebaseCore/FirebaseCore.h>
#import <FirebaseMessaging/FirebaseMessaging.h>

@interface NotificationService ()
  @property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
  @property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@end

@implementation NotificationService
  - (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    [[fyno app] handleDidReceive:request withContentHandler:contentHandler];
  }

  - (void)serviceExtensionTimeWillExpire {
    // Called just before the extension will be terminated by the system.
    // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
    self.contentHandler(self.bestAttemptContent);
  }
@end

```

#### NotificationService.swift

```swift
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

In order for the Notification Service Extension to be able to access **fyno**, you will have to import it by following the below steps:

#### Objective-C

1. In Xcode, select your Notification Service Extension target.
2. Under `Frameworks and Libraries`, click on the **+** button.
   ![](/docs/_fern-img/a709187ceb72b0ff49589037a6bca417a1667000c701d71264a6f44f91f5ebb9.webp)
3. Select the framework named **fyno.xcframework** and click on **Add**
   ![](/docs/_fern-img/9c2e03dfca87180ff22858cdf23f21d5acd85c9d7b8cf167390167c7759dcf40.webp)

#### Swift

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

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

3. Under `Add Other`, click on the `Add Package Dependency`.
   ![](/docs/_fern-img/42d1752848fd0b0ac4c9442e1e01b521ec2969ca0f9e673509da1fed6c50979c.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/27a822389d1116804c7f7aab23ed72d3603602afef6145a26a1809a68d2fd143.webp)

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

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