Skip to content

Registering Push Notifications Twice #3288

Closed
@bleonard

Description

@bleonard

I've been following #2332 and am glad that it looks like it will be in, but I still think there is an issue. I'm running iOS 8+

I'm seeing the push registration callback twice.

My appdelegate looks like this...

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
  [RCTPushNotificationManager application:application didRegisterUserNotificationSettings:notificationSettings];
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  [RCTPushNotificationManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
{
  [RCTPushNotificationManager application:application didReceiveRemoteNotification:notification];
}

The JS code ends up calling requestPermissions (RCTPushNotificationManager.m) which does

[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];

Then there is the appdelgate callback to didRegisterUserNotificationSettings and then didRegisterForRemoteNotificationsWithDeviceToken(both)

The first one calls back into RCTPushNotificationManager, which does this.

+ (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(__unused UIUserNotificationSettings *)notificationSettings
{
  [application registerForRemoteNotifications];
}

You'll note there is a second call to registerForRemoteNotifications

My iOS guy says he would remove the call to registerForRemoteNotifications in requestPermissions

Anyone else seeing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions