问题
我与Admob Pod有关iOS问题。在Android上,一切正常。在iOS上,我在尝试致电firebase.admob()
时会遇到以下错误:
Unhandled JS Exception: Error: Error: You attempted to use a firebase module that's not installed natively on your iOS project by calling firebase.admob().
Ensure you have the required Firebase iOS SDK pod for this module included in your Podfile, in this instance confirm you've added "pod 'Firebase/AdMob'" to your Podfile
See http://invertase.link/ios for full setup instructions.
This error is located at:
in Loading (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:376)
in NavigationContainer (at index.js:26)
in RCTView (at View.js:60)
in View (at index.js:18)
in StatusBarWarpper (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
This error is located at:
in NavigationContainer (at index.js:26)
in RCTView (at View.js:60)
in View (at index.js:18)
in StatusBarWarpper (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
作为react-native-track-player
库的疯狂猜测,我必须
Install react-native-swift to configure your iOS project to use the module correctly
After installing it, you will need to link it. Requires project to use Swift 4.2
https://reaect-native-kit.github.io/reaect-native-track-player/install/
我还尝试删除我的node_modules
,pod install
,pod update
并删除.lock
,但没有任何更改。
项目文件
反应本机
package.json
{
"name": "xxx",
"version": "xxx",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"postinstall": "cd tools && sh ./postYarn.sh && sh ./patchReact.sh",
"test": "jest"
},
"dependencies": {
"lodash": "^4.17.11",
"lottie-react-native": "^2.5.11",
"moment": "^2.24.0",
"moment-timezone": "^0.5.23",
"npm": "^5.8.0",
"react": "16.3.1",
"react-moment": "^0.8.3",
"react-native": "0.55.4",
"react-native-action-button": "^2.8.5",
"react-native-actionsheet": "^2.4.2",
"react-native-android-open-settings": "^1.3.0",
"react-native-background-timer": "^2.1.1",
"react-native-device-info": "^0.26.4",
"react-native-elements": "^0.19.1",
"react-native-fast-image": "^5.2.0",
"react-native-fbsdk": "^0.8.0",
"react-native-firebase": "~4.3.8",
"react-native-fs": "^2.11.17",
"react-native-gesture-handler": "^1.0.10",
"react-native-google-signin": "^1.0.2",
"react-native-hyperlink": "^0.0.14",
"react-native-i18n": "^2.0.12",
"react-native-image-crop-picker": "^0.23.0",
"react-native-image-zoom-viewer": "^2.2.25",
"react-native-iphone-x-helper": "^1.2.0",
"react-native-keyboard-aware-scroll-view": "^0.8.0",
"react-native-largelist-v2": "^2.1.1",
"react-native-linear-gradient": "^2.5.3",
"react-native-orientation": "^3.1.3",
"react-native-progress": "^3.5.0",
"react-native-settings-list": "^1.8.0",
"react-native-snap-carousel": "^3.7.5",
"react-native-splash-screen": "^3.1.1",
"react-native-spring-scrollview": "^0.0.24",
"react-native-swift": "^1.2.2",
"react-native-tab-view": "^1.3.2",
"react-native-track-player": "^1.1.3",
"react-native-vector-icons": "^5.0.0",
"react-native-xml2js": "^1.0.3",
"react-navigation": "^2.18.3",
"tcomb-form-native": "0.6.15"
},
"devDependencies": {
"babel-eslint": "^10.0.1",
"babel-jest": "23.6.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-react-native": "4.0.1",
"eslint": "^5.12.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-react": "^7.12.3",
"flow-bin": "^0.89.0",
"jest": "23.6.0",
"prettier-eslint": "^8.8.2",
"prop-types": "^15.6.2",
"react-test-renderer": "16.7.0"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./resources/fonts/"
]
},
"isSwift": true
}
ios
ios/Podfile
: # Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'xxx' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
rn_path = '../node_modules/react-native'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'RNFS', :path => '../node_modules/react-native-fs'
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'lottie-ios', :path => '../node_modules/lottie-ios'
pod 'lottie-react-native', :path => '../node_modules/lottie-react-native'
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'FBSDKCoreKit', '4.40'
pod 'FBSDKLoginKit', '4.40'
pod 'FBSDKShareKit', '4.40'
pod 'Firebase/Core', '~> 5.3.0'
pod 'Firebase/Auth', '~> 5.3.0'
pod 'Firebase/Database', '~> 5.3.0'
pod 'Firebase/Storage', '~> 5.3.0'
pod 'Firebase/Messaging', '~> 5.3.0'
pod 'Firebase/AdMob', '~> 5.3.0'
pod 'GoogleSignIn'
pod 'Fabric', '~> 1.7.5'
pod 'Crashlytics', '~> 3.10.4'
pod 'react-native-background-timer', :path => '../node_modules/react-native-background-timer'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
target 'xxx-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'xxxTests' do
inherit! :search_paths
# Pods for testing
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
# target 'xxx-tvOS' do
# # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# # use_frameworks!
# # Pods for xxx-tvOS
# target 'xxx-tvOSTests' do
# inherit! :search_paths
# # Pods for testing
# end
# end
podfile.lock
:
PODS:
- Bolts (1.9.0):
- Bolts/AppLinks (= 1.9.0)
- Bolts/Tasks (= 1.9.0)
- Bolts/AppLinks (1.9.0):
- Bolts/Tasks
- Bolts/Tasks (1.9.0)
- BVLinearGradient (2.5.3):
- React
- Crashlytics (3.10.9):
- Fabric (~> 1.7.13)
- Fabric (1.7.13)
- FBSDKCoreKit (4.40.0):
- Bolts (~> 1.9)
- FBSDKLoginKit (4.40.0):
- FBSDKCoreKit
- FBSDKShareKit (4.40.0):
- FBSDKCoreKit
- Firebase/AdMob (5.3.0):
- Firebase/Core
- Google-Mobile-Ads-SDK (= 7.31.0)
- Firebase/Auth (5.3.0):
- Firebase/CoreOnly
- FirebaseAuth (= 5.0.1)
- Firebase/Core (5.3.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 5.0.1)
- Firebase/CoreOnly (5.3.0):
- FirebaseCore (= 5.0.4)
- Firebase/Database (5.3.0):
- Firebase/CoreOnly
- FirebaseDatabase (= 5.0.1)
- Firebase/Messaging (5.3.0):
- Firebase/CoreOnly
- FirebaseMessaging (= 3.0.2)
- Firebase/Storage (5.3.0):
- Firebase/CoreOnly
- FirebaseStorage (= 3.0.0)
- FirebaseAnalytics (5.0.1):
- FirebaseCore (~> 5.0)
- FirebaseInstanceID (~> 3.0)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- nanopb (~> 0.3)
- FirebaseAuth (5.0.1):
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseCore (5.0.4):
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- FirebaseDatabase (5.0.1):
- FirebaseCore (~> 5.0)
- leveldb-library (~> 1.18)
- FirebaseInstanceID (3.1.1):
- FirebaseCore (~> 5.0)
- FirebaseMessaging (3.0.2):
- FirebaseCore (~> 5.0)
- FirebaseInstanceID (~> 3.0)
- GoogleToolboxForMac/Logger (~> 2.1)
- Protobuf (~> 3.1)
- FirebaseStorage (3.0.0):
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- Google-Mobile-Ads-SDK (7.31.0)
- GoogleSignIn (4.4.0):
- "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)"
- "GoogleToolboxForMac/NSString+URLArguments (~> 2.1)"
- GTMSessionFetcher/Core (~> 1.1)
- GoogleToolboxForMac/DebugUtils (2.2.0):
- GoogleToolboxForMac/Defines (= 2.2.0)
- GoogleToolboxForMac/Defines (2.2.0)
- GoogleToolboxForMac/Logger (2.2.0):
- GoogleToolboxForMac/Defines (= 2.2.0)
- "GoogleToolboxForMac/NSData+zlib (2.2.0)":
- GoogleToolboxForMac/Defines (= 2.2.0)
- "GoogleToolboxForMac/NSDictionary+URLArguments (2.2.0)":
- GoogleToolboxForMac/DebugUtils (= 2.2.0)
- GoogleToolboxForMac/Defines (= 2.2.0)
- "GoogleToolboxForMac/NSString+URLArguments (= 2.2.0)"
- "GoogleToolboxForMac/NSString+URLArguments (2.2.0)"
- GTMSessionFetcher/Core (1.2.1)
- leveldb-library (1.20)
- lottie-ios (2.5.0)
- lottie-react-native (2.5.11):
- lottie-ios
- React
- nanopb (0.3.901):
- nanopb/decode (= 0.3.901)
- nanopb/encode (= 0.3.901)
- nanopb/decode (0.3.901)
- nanopb/encode (0.3.901)
- Protobuf (3.7.0)
- QBImagePickerController (3.4.0)
- React (0.55.4):
- React/Core (= 0.55.4)
- react-native-background-timer (2.1.1):
- React
- react-native-fbsdk (0.8.0):
- React
- react-native-fbsdk/Core (= 0.8.0)
- react-native-fbsdk/Login (= 0.8.0)
- react-native-fbsdk/Share (= 0.8.0)
- react-native-fbsdk/Core (0.8.0):
- FBSDKCoreKit
- React
- react-native-fbsdk/Login (0.8.0):
- FBSDKLoginKit
- React
- react-native-fbsdk/Share (0.8.0):
- FBSDKShareKit
- React
- React/Core (0.55.4):
- yoga (= 0.55.4.React)
- React/fishhook (0.55.4)
- React/RCTActionSheet (0.55.4):
- React/Core
- React/RCTAnimation (0.55.4):
- React/Core
- React/RCTBlob (0.55.4):
- React/Core
- React/RCTGeolocation (0.55.4):
- React/Core
- React/RCTImage (0.55.4):
- React/Core
- React/RCTNetwork
- React/RCTLinkingIOS (0.55.4):
- React/Core
- React/RCTNetwork (0.55.4):
- React/Core
- React/RCTSettings (0.55.4):
- React/Core
- React/RCTText (0.55.4):
- React/Core
- React/RCTVibration (0.55.4):
- React/Core
- React/RCTWebSocket (0.55.4):
- React/Core
- React/fishhook
- React/RCTBlob
- RNDeviceInfo (0.21.5):
- React
- RNFS (2.13.3):
- React
- RNImageCropPicker (0.23.0):
- QBImagePickerController
- React/Core
- RSKImageCropper
- RSKImageCropper (2.2.1)
- yoga (0.55.4.React)
DEPENDENCIES:
- BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
- Crashlytics (~> 3.10.4)
- Fabric (~> 1.7.5)
- FBSDKCoreKit (= 4.40)
- FBSDKLoginKit (= 4.40)
- FBSDKShareKit (= 4.40)
- Firebase/AdMob (~> 5.3.0)
- Firebase/Auth (~> 5.3.0)
- Firebase/Core (~> 5.3.0)
- Firebase/Database (~> 5.3.0)
- Firebase/Messaging (~> 5.3.0)
- Firebase/Storage (~> 5.3.0)
- GoogleSignIn
- lottie-ios (from `../node_modules/lottie-ios`)
- lottie-react-native (from `../node_modules/lottie-react-native`)
- react-native-background-timer (from `../node_modules/react-native-background-timer`)
- react-native-fbsdk (from `../node_modules/react-native-fbsdk`)
- React/Core (from `../node_modules/react-native`)
- React/RCTActionSheet (from `../node_modules/react-native`)
- React/RCTAnimation (from `../node_modules/react-native`)
- React/RCTGeolocation (from `../node_modules/react-native`)
- React/RCTImage (from `../node_modules/react-native`)
- React/RCTLinkingIOS (from `../node_modules/react-native`)
- React/RCTNetwork (from `../node_modules/react-native`)
- React/RCTSettings (from `../node_modules/react-native`)
- React/RCTText (from `../node_modules/react-native`)
- React/RCTVibration (from `../node_modules/react-native`)
- React/RCTWebSocket (from `../node_modules/react-native`)
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNFS (from `../node_modules/react-native-fs`)
- RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`)
- yoga (from `../node_modules/react-native/ReactCommon/yoga/yoga.podspec`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Bolts
- Crashlytics
- Fabric
- FBSDKCoreKit
- FBSDKLoginKit
- FBSDKShareKit
- Firebase
- FirebaseAnalytics
- FirebaseAuth
- FirebaseCore
- FirebaseDatabase
- FirebaseInstanceID
- FirebaseMessaging
- FirebaseStorage
- Google-Mobile-Ads-SDK
- GoogleSignIn
- GoogleToolboxForMac
- GTMSessionFetcher
- leveldb-library
- nanopb
- Protobuf
- QBImagePickerController
- RSKImageCropper
EXTERNAL SOURCES:
BVLinearGradient:
:path: "../node_modules/react-native-linear-gradient"
lottie-ios:
:path: "../node_modules/lottie-ios"
lottie-react-native:
:path: "../node_modules/lottie-react-native"
React:
:path: "../node_modules/react-native"
react-native-background-timer:
:path: "../node_modules/react-native-background-timer"
react-native-fbsdk:
:path: "../node_modules/react-native-fbsdk"
RNDeviceInfo:
:path: "../node_modules/react-native-device-info"
RNFS:
:path: "../node_modules/react-native-fs"
RNImageCropPicker:
:path: "../node_modules/react-native-image-crop-picker"
yoga:
:path: "../node_modules/react-native/ReactCommon/yoga/yoga.podspec"
SPEC CHECKSUMS:
Bolts: ac6567323eac61e203f6a9763667d0f711be34c8
BVLinearGradient: 0d985ec461359c82bc254f26d11008bdae50d17a
Crashlytics: 55e24fc23989680285a21cb1146578d9d18e432c
Fabric: 25d0963b691fc97be566392243ff0ecef5a68338
FBSDKCoreKit: ae214474b25033399c131dc81d258e412582a2ba
FBSDKLoginKit: 7a1e411d46acc8834588eca437daf34de42e1d52
FBSDKShareKit: 0e45916f4150da485928ae2a17ca021950b194f5
Firebase: 68afeeb05461db02d7c9e3215cda28068670f4aa
FirebaseAnalytics: b3628aea54c50464c32c393fb2ea032566e7ecc2
FirebaseAuth: 463b8ce33bd5d05f706dcd4615499e3212b4132b
FirebaseCore: 62f1b792a49bb9e8b4073f24606d2c93ffc352f0
FirebaseDatabase: 482bad9c2abd422bb2321194fb8c937e67426a89
FirebaseInstanceID: f3f0657372592ecdfdfe2cac604a5a75758376a6
FirebaseMessaging: 6894b8fe0a0cf26c3b13dad729f1131654ae0bdb
FirebaseStorage: 7ca4bb7b58a25fa647b04f524033fc7cb7eb272b
Google-Mobile-Ads-SDK: 6e529e748b45507a2ca904e0b5a52669ba3920c4
GoogleSignIn: 7ff245e1a7b26d379099d3243a562f5747e23d39
GoogleToolboxForMac: ff31605b7d66400dcec09bed5861689aebadda4d
GTMSessionFetcher: 32aeca0aa144acea523e1c8e053089dec2cb98ca
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
lottie-ios: d699fdee68d7b63e721d949388b015fef1aaa4ac
lottie-react-native: 216bd1295fa67b159fdbe5562a7d7b6371da6422
nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48
Protobuf: 7a877b7f3e5964e3fce995e2eb323dbc6831bb5a
QBImagePickerController: d54cf93db6decf26baf6ed3472f336ef35cae022
React: 755b16d9a9387e856d4dce6528130c51e4d409b8
react-native-background-timer: 1b6e6b4e10f1b74c367a1fdc3c72b67c619b222b
react-native-fbsdk: 5c3ff4dda057e17d3b4b5491033fc653d423e71d
RNDeviceInfo: e7c5fcde13d40e161d8a27f6c5dc69c638936002
RNFS: c9bbde46b0d59619f8e7b735991c60e0f73d22c1
RNImageCropPicker: e56deca5b463b9493d22e966cfd83cb1fc5c99bb
RSKImageCropper: 98296ad26b41753f796b6898d015509598f13d97
yoga: c3ce6137f85f60c93a834235d7f08e2b44a42eed
PODFILE CHECKSUM: a41cd15a48dcf796ca32aafef7ca99217d4a86bb
COCOAPODS: 1.6.0
环境
平台您正在上遇到问题:
- [x] ios
react-native info
-
Environment:
OS: macOS High Sierra 10.13.6
Node: 8.11.2
Yarn: 1.9.4
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 10.1 Build version 10B61
Android Studio: 3.2 AI-181.5540.7.32.5056338
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4
非常感谢您的阅读:D
感谢Firebase团队的@Salakar,我可以发现问题是由Firebase缺少的POD库引起的。因此,我在Pod文件中添加了:
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
然后做了pod install
并将其启动到月球,因为它正在工作:D