我正在尝试建立反应原生项目的ios版本,android版本正在运行。我不能让ios版本在mac上运行,尝试使用expo,或者只使用模拟器。

在运行expo start之后,以下是错误:
Error: RNFirebase core module was not found natively on iOS, ensure you have correctly included the RNFirebase pod in your projects `Podfile` and have run `pod install`.
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.当我运行react-native run-ios时,我收到以下错误:
The following build commands failed:
CompileC /Users/agam/Library/Developer/Xcode/DerivedData/leaders-dwqehxydbohqcgbabuncaztlrzsn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseFirestore.o /Users/agam/Desktop/theleadersapp/node_modules/react-native-firebase/ios/RNFirebase/firestore/RNFirebaseFirestore.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNFirebase' from project 'Pods')
(1 failure)这是我的package.json
{
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"postinstall": "jetify"
},
"dependencies": {
"@expo/vector-icons": "^12.0.0",
"@react-native-async-storage/async-storage": "~1.15.0",
"@react-native-community/picker": "^1.8.1",
"@react-native-community/push-notification-ios": "^1.10.1",
"@react-native-firebase/app": "^12.9.1",
"@react-native-firebase/messaging": "^12.9.1",
"@react-native-picker/picker": "1.16.1",
"@unimodules/react-native-adapter": "~6.3.4",
"axios": "^0.19.2",
"expo": "^42.0.0",
"expo-cli": "^4.8.1",
"expo-font": "~9.2.1",
"hashmap": "^2.4.0",
"i18n-js": "^3.5.1",
"lodash.memoize": "^4.1.2",
"moment": "^2.24.0",
"pod-install": "^0.1.27",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "0.63.4",
"react-native-calendar-picker": "^6.0.5",
"react-native-datepicker": "^1.7.2",
"react-native-dropdown": "0.0.6",
"react-native-fbsdk": "^1.1.2",
"react-native-firebase": "^5.6.0",
"react-native-gesture-handler": "~1.10.2",
"react-native-htmlview": "^0.15.0",
"react-native-icon-badge": "^1.1.3",
"react-native-image-picker": "^2.3.0",
"react-native-instagram-login": "^2.0.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^1.3.1",
"react-native-modal": "^12.1.0",
"react-native-modal-picker": "0.0.16",
"react-native-multiple-select-list": "^1.0.4",
"react-native-paper": "^2.16.0",
"react-native-picker-module": "^2.0.4",
"react-native-picker-select": "^6.5.0",
"react-native-push-notification": "^7.4.0",
"react-native-reanimated": "~2.2.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.4.0",
"react-native-simple-radio-button": "^2.7.4",
"react-native-ui-xg": "0.0.6",
"react-native-unimodules": "~0.14.5",
"react-native-vector-icons": "^6.6.0",
"react-native-webview": "11.6.2",
"react-navigation": "^3.11.1",
"react-navigation-header-buttons": "^3.0.1",
"react-navigation-material-bottom-tabs": "^1.0.0",
"react-redux": "^7.1.3",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"unimodules-app-loader": "~2.2.0",
"watchman": "^1.0.0"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"@types/react": "~16.9.35",
"@types/react-native": "~0.63.2",
"babel-jest": "~24.9.0",
"babel-preset-expo": "8.3.0",
"jest": "~24.9.0",
"jetifier": "~1.6.4",
"metro-react-native-babel-preset": "~0.56.0",
"react-native-dotenv": "^0.2.0",
"react-test-renderer": "~16.9.0",
"redux-devtools-extension": "^2.13.8",
"typescript": "~4.0.0"
},
"private": true
}这是我的pod文件:
platform :ios, '11.0'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'leaders' do
# rnPrefix = "../node_modules/react-native"
use_unimodules!
config=use_native_modules!
use_react_native!(:path=>config["reactNativePath"])
end发布于 2021-10-14 12:31:08
cd ios // from your main directory
pod install此外,在这里您的podFile中注释掉了RNFirebase:
#pod 'RNFirebase', :path => '../node_modules/react-native-firebase'该错误提示您未安装此pod,这可能是原因
https://stackoverflow.com/questions/69568756
复制相似问题