【问题标题】:TypeError undefined is not an object (evaluating 'e.props.onChangeToken')TypeError undefined 不是对象(评估'e.props.onChangeToken')
【发布时间】:2018-01-19 10:24:01
【问题描述】:

我有一个 react-native 应用程序,它在 xCode 中运行良好(在模拟器和 iPhone 上)。但是,当上传到 TestFlight 并通过 TestFlight 安装时,应用程序在首次启动时会崩溃。当您再次打开该应用程序时,它运行良好。

在发布到 TestFlight 后,我​​使用 Bugsnag 从应用程序中获取错误报告。应用崩溃时我在 Bugsnag 中收到的错误是:

TypeError undefined is not an object (evaluating 'e.props.onChangeToken')

还有堆栈跟踪:

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

然而这并不能告诉我太多...

我怀疑它可能会在应用崩溃时连接到 Firebase:

  • 使用以下命令登录 Firebase:

firebase.auth().signInWithEmailAndPassword(email, password)

  • 请求初始通知:

FCM.getInitialNotification().then(notif => { this.setState({ initNotif: notif });

  • 请求通知权限:

FCM.requestPermissions({ badge: false, sound: true, alert: true });

但是我不确定。有没有人收到过类似的错误信息?

编辑 在此处对文章的评论中发现了一个 (!) 其他相同错误的案例:https://blog.botreetechnologies.com/how-to-send-push-notification-to-the-android-phones-using-react-native-and-fcm-b28e1746da7b

这意味着它可能与FCM有关......

【问题讨论】:

    标签: ios firebase react-native typeerror testflight


    【解决方案1】:

    原来错误是由我调用的事实引起的:

    FCM.getInitialNotification().then(notif => { this.setState({ initNotif: notif });
    

    在请求发送通知的权限之前...:

    FCM.requestPermissions({ badge: false, sound: true, alert: true });
    

    【讨论】:

      猜你喜欢
      • 2015-07-16
      • 2020-07-16
      • 2018-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多