React Native Expo 应用程序中的 Notifee 构建错误

问题描述 投票:0回答:1

我很想为我的 Expo 项目安装 Notifee,因为我需要本地和远程推送通知来与我的应用程序 (iOS/Android) 中的用户进行交互。

我按照网站上的说明操作,可以看到 Notifee 安装在我的 package.json 文件中

{
"name": "etmhomecrossexpo",
"version": "1.0.0",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"@notifee/react-native": "^7.8.2",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-navigation/native": "^6.1.14",
"@react-navigation/native-stack": "^6.9.22",
"@types/react": "~18.2.45",
"expo": "~50.0.11",
"expo-application": "~5.8.3",
"expo-build-properties": "~0.11.1",
"expo-dev-client": "~3.3.9",
"expo-device": "~5.9.4",
"expo-screen-orientation": "~6.4.1",
"expo-status-bar": "~1.11.1",
"highcharts": "^11.4.0",
"i18next": "^23.10.1",
"moment-timezone": "^0.5.45",
"react": "18.2.0",
"react-i18next": "^14.1.0",
"react-native": "0.73.6",
"react-native-base64": "^0.2.1",
"react-native-change-icon": "^5.0.0",
"react-native-device-info": "^10.13.1",
"react-native-localize": "^3.0.6",
"react-native-modal": "^13.0.1",
"react-native-pager-view": "^6.2.3",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-sqlite-storage": "^6.0.1",
"react-native-webview": "^13.8.4",
"react-native-xml2js": "^1.0.3",
"semver": "^7.6.3",
"typescript": "^5.3.0",
"xml-formatter": "^3.6.2",
"xml-js": "^1.6.11",
"xml2js": "^0.6.2"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@react-native-community/datetimepicker": "^7.6.3",
"@react-native-picker/picker": "^2.7.2",
"react-native-wheel-pick": "^1.2.2"
},
"private": true
}

之后,我仅在我的应用程序文件之一中添加导入行

import notifee from '@notifee/react-native';

现在我想在我的设备(Android 和 iPhone)上尝试一下。在 Android 上,我在 npx expo run:android 之后没有问题,并且它运行了,相反我的 iOS 应用程序没有构建:我尝试使用 eas build --platform ios --local 进行构建,然后我得到了这个

Fastlane is not available, make sure it's installed and in your PATH spawn fastlane ENOENT npx exited with non-zero code: 1

还尝试使用旧的开发版本,并尝试使用我自己的开发服务器运行 npx expo start --dev-client 我遇到了错误:

ERROR Error: Notifee native module not found.
ERROR Invariant Violation: "main" has not been registered. This can happen if:

Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
A module failed to load due to an error and AppRegistry.registerComponent wasn't called.
› Stopped server

在网上搜索了一番后我没有找到解决方案,你有什么建议给我吗?

提前谢谢您

ios react-native push-notification expo notifications
1个回答
0
投票

不幸的是,Notifee 网站上的文档已经过时了

请参阅Github上的源文档。

© www.soinside.com 2019 - 2024. All rights reserved.