Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For the current latest version (5.x) of RN Firebase, calling `requestPermission` also calls the `registerForRemoteNotifications` method. This is required for the fcm token retrieved to be associated to a valid APNS token, and for push notifications to be delivered correctly to the device. (invertase/react-native-firebase#1203 (comment)) I have been debugging an issue with push notifications and consistently calling the `requestPermission` method even when the user already granted permissions was the only fix. There is also a `firebase.messaging().ios.registerForRemoteNotifications()` method available, but I found that when I called it from the JS thread, a warning popped up in Xcode saying that this method (the underlying `[RCTSharedApplication() registerForRemoteNotifications]` call) should only be made from the main thread. This does not prompt the user on iOS after the first time the user responds to the dialog, so the user experience is not hurt by running this code over and over.
- Loading branch information
12f6920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I missing something here? The commit message says to call requestPermission but the readme now says to call hasPermission()
12f6920
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TimMun I think you are right https://github.com/invertase/react-native-firebase-docs/blob/12f692051d/docs/messaging/reference/Messaging.md#requestpermission appears to be the one we want