![](/img/trans.png)
[英]evollu/react-native-fcm - ClassNotFoundException
[英]Error handling on react-native-fcm
我正在使用https://github.com/evollu/react-native-fcm在我的react-native應用程序上集成FCM。 通知有效但我每次都收到此錯誤。
console.error: "Notification handler err", {"line":67974,"column":14,"sourceURL":"http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false"}
環境:react-native-cli:2.0.1
反應原生:0.40.0
react-native-fcm:6.1.0
我在Android ver 6.0.1上測試,應用程序正在前台運行。
我在index.js上刪除了舊代碼Firebase初始化代碼,導致錯誤。
firebase.initializeApp({
apiKey: "",
authDomain: "",
databaseURL: "",
storageBucket: ""
});
我刪除它,它現在正在工作。
FCM.on("FCMNotificationReceived", (notification) => {
if (Platform.OS === 'ios') {
if (notification && notification.aps) {
const localNotification = {
title: notification.aps.alert.title,
body: notification.aps.alert.body,
show_in_foreground: true,
}
FCM.presentLocalNotification(localNotification);
}
}
});
FCM.on("FCMNotificationReceived", (notification) => {
// Also trigged when FCM.presentLocalNotification() and callback a notification without **aps** object;
// So the app crash, error
// Just check if (notification && notification.aps) and make localNotification object like above code
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.