React Native FCM推送通知令牌为null

时间:2018-06-28 16:42:06

标签: firebase react-native firebase-cloud-messaging react-native-fcm

我正在开发一个React Native项目,我需要使用react-native-fcm在iOS和Android终端上设置推送通知, 当我尝试获取令牌时,它在Android中返回null,在iOS中返回以下错误:

Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read property 'requestPermissions' of undefined
TypeError: Cannot read property 'requestPermissions' of undefined
    at Object.FCM.requestPermissions (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:143309:27)
    at PushNotificationController.componentDidMount$ (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:143144:58)
    at tryCatch (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:16751:19)
    at Generator.invoke [as _invoke] (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:16924:24)
    at Generator.prototype.(anonymous function) [as next] (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:16794:23)
    at tryCatch (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:16751:19)
    at invoke (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:16827:22)
    at blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:16855:13
    at tryCallTwo (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:3524:7)
    at doResolve (blob:http://localhost:8081/4a6e4d63-516d-4288-ac74-d1494e78d48f:3688:15)

感谢您的回复,我随时可以提供更多信息。

1 个答案:

答案 0 :(得分:0)