I have an react-native app which runs fine in xCode (both in simulator and on iPhone). However when uploaded to TestFlight and installed through TestFlight the app crashes when first started. When you then open the app again it runs fine.
I use Bugsnag to get error reports from the app after released to TestFlight. The error I receive in Bugsnag when the app crashes is:
TypeError undefined is not an object (evaluating 'e.props.onChangeToken')
And the stacktrace:
main.jsbundle:518:677
main.jsbundle:37:1281 value
main.jsbundle:18:2853 value
main.jsbundle:18:280
main.jsbundle:18:2304 value
main.jsbundle:18:252 callFunctionReturnFlushedQueue
However this does not tell me much ...
I suspect that it might be connected to Firebase since around when the app crashes I:
firebase.auth().signInWithEmailAndPassword(email, password)
FCM.getInitialNotification().then(notif => {
this.setState({
initNotif: notif
});
FCM.requestPermissions({ badge: false, sound: true, alert: true });
However I'm not sure. Has anyone ever received a similar error message?
EDIT Found one (!) other case of the same error in a comment to the article here: https://blog.botreetechnologies.com/how-to-send-push-notification-to-the-android-phones-using-react-native-and-fcm-b28e1746da7b
This implies that it could be related to FCM...
Turns out that the error was caused by the fact that I called:
FCM.getInitialNotification().then(notif => { this.setState({ initNotif: notif });
Before requesting permission for sending notifications... :
FCM.requestPermissions({ badge: false, sound: true, alert: true });