react-native-fcm: Failed to grant permission ios 10.3.1
i am trying to use this code in iOS 10.3.1 but gettint error of failed to grant permissions:
componentDidMount(){
if(Platform.OS === 'ios'){
FCM.requestPermissions({badge: false, sound: true, alert: true});
try {
console.log("[Push] requestPermissions");
const values = await FCM.requestPermissions({badge: false, sound: true, alert: true});
console.log(values);
} catch(err){
console.log("[Push] requestPermissions error: " + err);
return;
}
}
}

About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28 (12 by maintainers)
@natashache like @evollu says, the actual OS (on iOS) modal is only shown once, after that it returns the choice the user made; being acknowledged or rejected the notifications. In the code, you can dispatch the
requestPermissionsPromise. It will only resolve when the user accepted the permissions, it will reject if the user denied.In our code, we handle it this way:
For now we only handle the iOS part since our Android app is not targeted for runtime notifications. This might change soon though… I hope this helps!