Skip to content

iOS9 Notifications

With the following snippet applied to your ios/<YourAppName>/AppDelegate.m, if your app is closed or in background, a system notification will be added to the Notification Center. If your app is in foreground, the notification will be shown inside the app.


// ...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // ...
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil]];
    // ...
    return YES;
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
  [[RNNearIt defaultManager] application:application didReceiveRemoteNotification:userInfo];
}

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
  [[RNNearIt defaultManager] application:application didReceiveLocalNotification:notification];
}