invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.66k stars 2.21k forks source link

🔥 [IOS] Admob - You attempted to use a firebase module that's not installed natively on your iOS project by calling firebase.admob() #1948

Closed ishigamii closed 5 years ago

ishigamii commented 5 years ago

Issue

I am having an issue on iOS with the adMob pod. On Android everything works fine. On iOS I get the following error when trying to call 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)

As a wild guess for the react-native-track-player library I had to

 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://react-native-kit.github.io/react-native-track-player/install/

I also tried to remove my node_modules, pod install,pod update and delete the .lock but nothing made any change.


Project Files

React native

`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:

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:

DEPENDENCIES:

SPEC REPOS: https://github.com/cocoapods/specs.git:

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


#### `AppDelegate.m`:

```objc
// N/A

Android

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment

Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: 0.55.4 => 0.55.4



- **`Firebase` module(s) you're using that has the issue:**
  - [] **N/A**
  - [X] Admob
  - [ ] Authentication
  - [ ] Analytics
  - [ ] Cloud **Firestore**
  - [ ] Cloud **Messaging** (FCM)
  - [ ] Crashlytics
  - [ ] Dynamic **Links**
  - [ ] **Functions** Callable
  - [ ] In App Messaging
  - [ ] Indexing
  - [ ] Invites
  - [ ] Instance ID
  - [ ] ML Kit
  - [ ] Notifications
  - [ ] Performance Monitoring
  - [ ] Realtime **Database**
  - [ ] Remote **Config**
  - [ ] Storage
- **Are you using `TypeScript`?**
  - [ ] No
  - [ ] Yes, version: `N/A`
- **Are you using Expo, e.g. `ExpoKit`?**
  - [x] No
  - [ ] Yes, I've _not_ ejected
  - [ ] Yes, but I **have** ejected to `ExpoKit`
  - [ ] Yes, but I **have** ejected to vanilla React Native
  - Expo version: `N/A`
---

Think `react-native-firebase` is great? Please consider supporting the project with any of the below:

- 👉 Donate via [Open Collective](https://opencollective.com/react-native-firebase/donate)
- 👉 Follow [`React Native Firebase`](https://twitter.com/rnfirebase) and [`Invertase`](https://twitter.com/invertaseio) on Twitter
- 👉 Star this repo on GitHub ⭐️
- 👉 Contribute; see our [contributing guide](./../../CONTRIBUTING.md)
ishigamii commented 5 years ago

Thanks to Salakar from the firebase team I could find that the issue was caused by the missing pod library for Firebase. So I added in my pod file :

pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'

Then did a pod install And launch it to the moon cause it was working :D

chrise86 commented 5 years ago

I'm also getting this error and also using track-player, however adding that line to the Podfile does not work for me.

jeanlambert17 commented 5 years ago

I'm also getting this error...

This is my Podfile:

`

target 'FaceJob' do rn_path = '../node_modules/react-native'

pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec" pod 'React', path: rn_path, subspecs: [ 'Core', 'CxxBridge', 'DevSupport', 'RCTActionSheet', 'RCTAnimation', 'RCTGeolocation', 'RCTImage', 'RCTLinkingIOS', 'RCTNetwork', 'RCTSettings', 'RCTText', 'RCTVibration', 'RCTWebSocket', 'RCTPushNotification' ]

pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec" pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec" pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

pod 'react-native-camera', path: '../node_modules/react-native-camera' pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info' pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker' pod 'ReactNativeKeyboardManager', :path => '../node_modules/react-native-keyboard-manager' pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios' pod 'Firebase/Core', '~> 6.3.0' pod 'Firebase/AdMob', '~> 6.3.0' pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec' pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk' pod 'ReactNativeLocalization', :path => '../node_modules/react-native-localization' pod 'react-native-google-places', :path => '../node_modules/react-native-google-places' pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal', :inhibit_warnings => true pod 'CodePush', :path => '../node_modules/react-native-code-push' pod 'Google-Mobile-Ads-SDK' pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage' pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen' pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake' pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

end

post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'react-native-google-maps' target.build_configurations.each do |config| config.build_settings['CLANG_ENABLE_MODULES'] = 'No' end end

targets_to_ignore = %w(React yoga)

if target.name == "React"
  target.remove_from_project
end

if targets_to_ignore.include? target.name
  target.remove_from_project
end

end end

`

And this is my Podfile.lock ` PODS:

DEPENDENCIES:

SPEC REPOS: https://github.com/cocoapods/specs.git:

EXTERNAL SOURCES: CodePush: :path: "../node_modules/react-native-code-push" DoubleConversion: :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" Folly: :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec" glog: :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" React: :path: "../node_modules/react-native" react-native-camera: :path: "../node_modules/react-native-camera" react-native-fbsdk: :path: "../node_modules/react-native-fbsdk" react-native-google-places: :path: "../node_modules/react-native-google-places" react-native-keep-awake: :path: "../node_modules/react-native-keep-awake" react-native-onesignal: :path: "../node_modules/react-native-onesignal" react-native-splash-screen: :path: "../node_modules/react-native-splash-screen" react-native-video: :path: "../node_modules/react-native-video/react-native-video.podspec" ReactNativeKeyboardManager: :path: "../node_modules/react-native-keyboard-manager" ReactNativeLocalization: :path: "../node_modules/react-native-localization" RNCAsyncStorage: :path: "../node_modules/@react-native-community/async-storage" RNDeviceInfo: :path: "../node_modules/react-native-device-info" RNFirebase: :path: "../node_modules/react-native-firebase/ios" RNGestureHandler: :path: "../node_modules/react-native-gesture-handler" RNImageCropPicker: :path: "../node_modules/react-native-image-crop-picker" RNVectorIcons: :path: "../node_modules/react-native-vector-icons" yoga: :path: "../node_modules/react-native/ReactCommon/yoga/yoga.podspec"

SPEC CHECKSUMS: Base64: cecfb41a004124895a7bcee567a89bae5a89d49b boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c CodePush: 284402fb7418973c3f24a0a9cf0d1d48d96a97c8 Crashlytics: 2dfd686bcb918dc10ee0e76f7f853fe42c7bd552 DoubleConversion: bb338842f62ab1d708ceb63ec3d999f0f3d98ecd Fabric: 706c8b8098fff96c33c0db69cbf81f9c551d0d74 FBSDKCoreKit: 3e41c402eb64ea7799c71833ff9e5690f27b9c42 FBSDKLoginKit: a88f36da648e4c5d60eb261c63eac067abb97130 FBSDKShareKit: 8695bbb97c18a381bbf2851a3f24f95a59121b82 Firebase: 8432d732974498afd5987e9001a05f90f1a3d625 FirebaseAnalytics: 470ddab7253b21ad5a40bebd4a9903d7ae19386a FirebaseCore: 68f8a7f50cdae542715d4e86afa37c4067217dcb FirebaseInstanceID: 9782fcfb89e4d7da76cc28eac4b8543dc7be4a4b Folly: de497beb10f102453a1afa9edbf8cf8a251890de glog: aefd1eb5dda2ab95ba0938556f34b98e2da3a60d Google-Mobile-Ads-SDK: a10b30f4a51a3283df7df3c9ea7e84553b508e4b GoogleAppMeasurement: a35a645835bae31b6bdc0576396bc23908f12a22 GoogleMaps: 5c13302e6fe6bb6e686b267196586b91cd594225 GooglePlaces: e874db179f2675c4f3eeda0b686b540273a578b0 GoogleUtilities: d2b0e277a95962e09bb27f5cd42f5f0b6a506c7d IQKeyboardManager: 8eab4d8111418414619d1df8e4779ce5d0f8d7e2 JWT: 05028b9624591bba9681bb57df2c5f95fa258bad nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48 OneSignal: 0f5ff711d9f25da54885e4ab06ef0abc221a46ef QBImagePickerController: d54cf93db6decf26baf6ed3472f336ef35cae022 React: a86b92f00edbe1873a63e4a212c29b7a7ad5224f react-native-camera: 37580137d13b0f2fabd631e4217eb11f0e4d5764 react-native-fbsdk: bc1d3e321e8a710feaf8763d747707972d6c4299 react-native-google-places: a667a22f22eaefec7aee140d842b43a898fa5b86 react-native-keep-awake: 282a6c2d91e16907ddbe731e0fabdbdb56fd7b22 react-native-onesignal: 4d16f59736eb92e892fb009cb66a7c508fdeead0 react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865 react-native-video: 0871593feb37ae297a20943d77a142b30a1776b6 ReactNativeKeyboardManager: ed6aeecadae8dff5404c446c5c16d7208290d348 ReactNativeLocalization: 00800abad36a2a902b131c690d3e6143198ccc8a RNCAsyncStorage: 63407ea82f1b5ac8fc53a0b8c569b08e0516a9e0 RNDeviceInfo: 5a3ae865d1736d2305be149578928b0c7198e852 RNFirebase: 7d4733713a0f436d55388b55ca3744385c70fd2d RNGestureHandler: 5329a942fce3d41c68b84c2c2276ce06a696d8b0 RNImageCropPicker: 6134b66a3d5bc13e2895a97c630a4254006902b4 RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4 RSKImageCropper: 05e3b82a18da83ea3c2b7bffa7f2199a621d6802 SSZipArchive: fa16b8cc4cdeceb698e5e5d9f67e9558532fbf23 yoga: 03ff42a6f223fb88deeaed60249020d80c3091ee

PODFILE CHECKSUM: 07d1e649fa5261a012ac340ca09679d899344d06

COCOAPODS: 1.7.2

`

mikehardy commented 5 years ago

2210 may have what you need