Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PushNotificationIOS Documentation Has Step that Leads to Error #5162

Closed
mikeborozdin opened this issue Jan 6, 2016 · 13 comments
Closed

PushNotificationIOS Documentation Has Step that Leads to Error #5162

mikeborozdin opened this issue Jan 6, 2016 · 13 comments
Labels
Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@mikeborozdin
Copy link

The documentation of PushNotificationIOS says one needs to add

   // Required to register for notifications
   - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
   {
    [RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings];
   }
   // Required for the register event.
   - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
   {
    [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
   }
   // Required for the notification event.
   - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
   {
    [RCTPushNotificationManager didReceiveRemoteNotification:notification];
   }

to AppDelegate.m

However, the first method, namely

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

results in an compilation error that says

No class method for selector 'didRegisterUserNotificationSettings:notificationSettings'

@facebook-github-bot
Copy link
Contributor

Hey mikeborozdin, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@hyugit
Copy link

hyugit commented Jan 7, 2016

Are you using an older version of ReactNative? if you go to RCTPushNotificationManager.h file, you will be able to see the actual available methods for your version.

@hernanmateo
Copy link

Same error here

@kushal
Copy link
Contributor

kushal commented Jan 15, 2016

Afaict, these methods all require application for the first argument, and the documentation, is just wrong? i.e.

// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
  [RCTPushNotificationManager application:application didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  [RCTPushNotificationManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Required for the notification event.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
{
  [RCTPushNotificationManager application:application didReceiveRemoteNotification:notification];
}

wfm

@daemonchen
Copy link
Contributor

same error

@rollick
Copy link

rollick commented Jan 21, 2016

For the latest versions of react-native, see here:

* // Required to register for notifications
* - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
* {
* [RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings];
* }
* // Required for the register event.
* - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
* {
* [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
* }
* // Required for the notification event.
* - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
* {
* [RCTPushNotificationManager didReceiveRemoteNotification:notification];
* }

@yamill
Copy link
Contributor

yamill commented Jan 28, 2016

I'm having the same error

@ide ide added Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. Platform: iOS iOS applications. labels Jan 28, 2016
@jihopark
Copy link

jihopark commented Feb 2, 2016

* // Required to register for notifications
* - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
* {
* [RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings];
* }
* // Required for the register event.
* - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
* {
* [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
* }
* // Required for the notification event.
* - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
* {
* [RCTPushNotificationManager didReceiveRemoteNotification:notification];
* }
This solves. the problem @rollick

but why isn't this mentioned in the Release note? it is a breaking change, no?

@yamill
Copy link
Contributor

yamill commented Feb 2, 2016

I have a fix for this. I'll be a submitting a PR sometime soon.

@scgough
Copy link

scgough commented Feb 2, 2016

Can I confirm what solves the problem @rollick @jihopark ?

I have the following in my AppDelegate.m file but still have the No known class method for selector ### error on each of those methods.

#import "RCTPushNotificationManager.h"
...
// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
  [RCTPushNotificationManager didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  [RCTPushNotificationManager didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

// Required for the notification event.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
{
  [RCTPushNotificationManager didReceiveRemoteNotification:notification];
}

UPDATE
Adding application:application (as @kushal suggested) to the beginning of each method seems to eradicate the issue:

// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
  [RCTPushNotificationManager application:application didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  [RCTPushNotificationManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

// Required for the notification event.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
{
  [RCTPushNotificationManager application:application didReceiveRemoteNotification:notification];
}

@christopherdro
Copy link
Contributor

@joshuagutierrez What's the resolution here?

@joshuagutierrez
Copy link

Sorry, this issue is still open? I got confused when you closed #5746, I read it as "5746 is closed, and it also fixes the same problem as 5162" - I see you mean that "5746 re-asks the open issue 5162"

@grabbou
Copy link
Contributor

grabbou commented Apr 24, 2016

I think it was just an issue of docs being out of sync with the current master (when we didn't have per-version docs).

As of current master and 0.24 - the documentation does not have application:(UIApplication *)application which matches the native methods

That was the commit that changed the payloads 1dc5dca

@grabbou grabbou closed this as completed Apr 24, 2016
@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Help Wanted :octocat: Issues ideal for external contributors. Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests