Cannot read property 'RefreshToken' of undefined
See original GitHub issueHi, I got exception as soon as I added the FCM SDK and get it launched.
Versions: “react-native-fcm”: “^2.5.6”, “react-native”: “0.39.2”,
Device: ios 10.3 emulator
X Code
// ADDED
[FIRApp configure];
[[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
// ADDED
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
{
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:notification.request.content.userInfo];
if([[notification.request.content.userInfo valueForKey:@"show_in_foreground"] isEqual:@YES]){
completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
}else{
completionHandler(UNNotificationPresentationOptionNone);
}
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler
{
NSDictionary* userInfo = [[NSMutableDictionary alloc] initWithDictionary: response.notification.request.content.userInfo];
[userInfo setValue:@YES forKey:@"opened_from_tray"];
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:userInfo];
}
//You can skip this method if you don't want to use local notification
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:notification.userInfo];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:userInfo];
completionHandler(UIBackgroundFetchResultNoData);
}
JS Code:
componentDidMount() {
// push Notification
FCM.requestPermissions(); // for iOS
FCM.getFCMToken().then(token => {
console.log('>>>> get FCM token:', token);
});
refreshTokenListener = FCM.on(FCMEvent.RefreshToken, (token) => {
console.log('>>>> refreshTokenListener FCM token:', token);
});
notificationListener = FCM.on(FCMEvent.Notification, async (notif) => {
});
}
// ERRORS ExceptionsManager.js:63 Cannot read property ‘RefreshToken’ of undefined Unhandled JS Exception: Cannot read property ‘RefreshToken’ of undefined
Issue Analytics
- State:
- Created 6 years ago
- Comments:9
Top Results From Across the Web
Cannot read property 'then' of undefined when using JWT ...
Sorry I'm new to backend (nodejs) and I'm trying to build a JWT token and refresh token but I stumbled across an error...
Read more >Refresh token gives "Cannot read property 'scope' of undefined"
The first error seems like there is something wrong with the request, and the second error looks like the application is not authorized...
Read more >cannot read property 'token' of undefined react
The error generally means that something went wrong when the tool makes the authentication call - it is looking for the token and...
Read more >cannot read properties of undefined (reading 'refresh') - You.com
To solve the "Cannot read properties of undefined" error, make sure to insert the JS script tag at the bottom of the body....
Read more >ERROR TypeError: Cannot read property 'token' of undefined ...
I and trying to build an using a php API, I have been able to login, but when I tried to access other...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MaxToyberman Great! It works well after replacing with
refreshToken
. ThanksGetting the same issue. Anyone got any solution?