我正在尝试使用Expo通知服务在我的应用程序中创建推送通知。我按照官方文档中的设置指南操作:https://docs.expo.dev/push-notifications/push-notifications-setup/
但是,我得到了以下错误,而不是获取设备令牌:[Unhandled promise rejection: Error: Fetching the token failed: Please set your Project ID. A valid Firebase Project ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.] at node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:106:59 in promiseMethodWrapper at node_modules/expo-modules-core/build/NativeModulesProxy.native.js:15:45 in moduleName.methodInfo.name at node_modules/expo-notifications/build/getDevicePushTokenAsync.js:15:69 in getDevicePushTokenAsync at node_modules/expo-notifications/build/getDevicePushTokenAsync.js:4:53 in getDevicePushTokenAsync at node_modules/expo-notifications/build/getExpoPushTokenAsync.js:9:85 in getExpoPushTokenAsync at node_modules/expo-notifications/build/getExpoPushTokenAsync.js:8:51 in getExpoPushTokenAsync
环境信息:
我正在使用Expo管理的工作流。Expo版本45.0.0。`
感觉好像我应该配置我的firebase项目,但我仍然在expo go上运行它,根据文档,我应该只需要在构建阶段这样做。我还是尝试了,但没有成功。还尝试阅读错误提供的链接,并试图更改我的firebase init选项,但我不确定我是否做对了。
1条答案
按热度按时间uttx8gqw1#
在调用
getExpoPushTokenAsync()
时,可能需要传递项目ID,如下所示:(参考:https://github.com/expo/expo/issues/18570#issuecomment-1235788144)