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() :
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 App (at renderApplication.js:34)
in RCTView (at View.js:45)
in View (at AppContainer.js:98)
in RCTView (at View.js:45)
in View (at AppContainer.js:115)
in AppContainer (at renderApplication.js:33)
initialiseNativeModule
native.js:43:20
ModuleBase
ModuleBase.js:26:27
AdMob
index.js:21:4
<unknown>
apps.js:66:74
getModule
apps.js:186:20
App
App.js:98:21
App
[native code]:0
<unknown>
createClassProxy.js:98:23
instantiate
createClassProxy.js:96:6
constructClassInstance
ReactNativeRenderer-dev.js:8864:26
updateClassComponent
ReactNativeRenderer-dev.js:11508:6
performUnitOfWork
ReactNativeRenderer-dev.js:16075:21
workLoop
ReactNativeRenderer-dev.js:16115:41
renderRoot
ReactNativeRenderer-dev.js:16219:15
performWorkOnRoot
ReactNativeRenderer-dev.js:17198:17
performWork
ReactNativeRenderer-dev.js:17099:24
performSyncWork
ReactNativeRenderer-dev.js:17060:14
requestWork
ReactNativeRenderer-dev.js:16925:19
scheduleWork
ReactNativeRenderer-dev.js:16724:16
scheduleRootUpdate
ReactNativeRenderer-dev.js:17413:15
render
ReactNativeRenderer-dev.js:18191:20
renderApplication
renderApplication.js:59:34
run
AppRegistry.js:101:10
runApplication
AppRegistry.js:195:26
__callFunction
MessageQueue.js:366:47
<unknown>
MessageQueue.js:106:26
__guard
MessageQueue.js:314:10
callFunctionReturnFlushedQueue
MessageQueue.js:105:17
callFunctionReturnFlushedQueue
[native code]:0
I've tried re-do the initial setup guide on my project. And adding this pod:
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
but I still have this issue
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:
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!
# Pods for xxx
pod 'React', :path => '../node_modules/react-native'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'Firebase/Core', '~> 5.15.0'
pod 'Firebase/Database', '~> 5.15.0'
pod 'Firebase/AdMob', '~> 5.15.0'
pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
target 'xxx' do
inherit! :search_paths
# Pods for testing
end
target 'xxx' do
inherit! :search_paths
# Pods for testing
end
end
`podfile.lock`:
PODS:
- Firebase/AdMob (5.15.0):
- Firebase/Core
- Google-Mobile-Ads-SDK (~> 7.37)
- Firebase/Core (5.15.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 5.4.0)
- Firebase/CoreOnly (5.15.0):
- FirebaseCore (= 5.1.10)
- Firebase/Database (5.15.0):
- Firebase/CoreOnly
- FirebaseDatabase (= 5.0.4)
- FirebaseAnalytics (5.4.0):
- FirebaseCore (~> 5.1)
- FirebaseInstanceID (~> 3.3)
- GoogleAppMeasurement (= 5.4.0)
- GoogleUtilities/AppDelegateSwizzler (~> 5.2)
- GoogleUtilities/MethodSwizzler (~> 5.2)
- GoogleUtilities/Network (~> 5.2)
- "GoogleUtilities/NSData+zlib (~> 5.2)"
- nanopb (~> 0.3)
- FirebaseAuthInterop (1.0.0)
- FirebaseCore (5.1.10):
- GoogleUtilities/Logger (~> 5.2)
- FirebaseDatabase (5.0.4):
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 5.1)
- leveldb-library (~> 1.18)
- FirebaseInstanceID (3.3.0):
- FirebaseCore (~> 5.1)
- GoogleUtilities/Environment (~> 5.3)
- GoogleUtilities/UserDefaults (~> 5.3)
- Google-Mobile-Ads-SDK (7.41.0)
- GoogleAppMeasurement (5.4.0):
- GoogleUtilities/AppDelegateSwizzler (~> 5.2)
- GoogleUtilities/MethodSwizzler (~> 5.2)
- GoogleUtilities/Network (~> 5.2)
- "GoogleUtilities/NSData+zlib (~> 5.2)"
- nanopb (~> 0.3)
- GoogleUtilities/AppDelegateSwizzler (5.6.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (5.6.0)
- GoogleUtilities/Logger (5.6.0):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (5.6.0):
- GoogleUtilities/Logger
- GoogleUtilities/Network (5.6.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (5.6.0)"
- GoogleUtilities/Reachability (5.6.0):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (5.6.0):
- GoogleUtilities/Logger
- leveldb-library (1.20)
- nanopb (0.3.901):
- nanopb/decode (= 0.3.901)
- nanopb/encode (= 0.3.901)
- nanopb/decode (0.3.901)
- nanopb/encode (0.3.901)
- React (0.58.6):
- React/Core (= 0.58.6)
- React/Core (0.58.6):
- yoga (= 0.58.6.React)
- RNCAsyncStorage (1.4.0):
- React
- yoga (0.58.6.React)
DEPENDENCIES:
- Firebase/AdMob (~> 5.15.0)
- Firebase/Core (~> 5.15.0)
- Firebase/Database (~> 5.15.0)
- React (from `../node_modules/react-native`)
- "RNCAsyncStorage (from `../node_modules/@react-native-community/async-storage`)"
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Firebase
- FirebaseAnalytics
- FirebaseAuthInterop
- FirebaseCore
- FirebaseDatabase
- FirebaseInstanceID
- Google-Mobile-Ads-SDK
- GoogleAppMeasurement
- GoogleUtilities
- leveldb-library
- nanopb
EXTERNAL SOURCES:
React:
:path: "../node_modules/react-native"
RNCAsyncStorage:
:path: "../node_modules/@react-native-community/async-storage"
yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
Firebase: 8bb9268bff82374f2cbaaabb143e725743c316ae
FirebaseAnalytics: c06f9d70577d79074214700a71fd5d39de5550fb
FirebaseAuthInterop: 0ffa57668be100582bb7643d4fcb7615496c41fc
FirebaseCore: 35747502d9e8c6ee217385ad04446c7c2aaf9c5c
FirebaseDatabase: 0621689f77528d62b47e1c06ca737c4c19275d1a
FirebaseInstanceID: e2fa4cb35ef5558c200f7f0ad8a53e212215f93e
Google-Mobile-Ads-SDK: 101ce89b94fdf60ec64ba7b6e9b9d812dc765936
GoogleAppMeasurement: 98b71f5e04142793729a5ef23e5b96651ff4b70f
GoogleUtilities: f44b068df02195da10409f415bd8c98439cd70fa
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48
React: 130b87b2d5e2baac646954282cab87be986d98fc
RNCAsyncStorage: b82dc6e5b39a625d70e3b3492bff75c0de94ba71
yoga: 32d7ef1081951e9a35a4c72a7be797598b138a48
PODFILE CHECKSUM: 7c7dc6ad557e143e89cd532086f991b949c19580
COCOAPODS: 1.6.1
#### `AppDelegate.m`:
// N/A
Click To Expand
#### `android/build.gradle`:
// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->
Click To Expand
**`react-native info` output:**
React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
Memory: 1.17 GB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.6.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 27, 28
Build Tools: 27.0.3, 28.0.3
System Images: android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.58.6 => 0.58.6
npmGlobalPackages:
react-native-app-id: 0.0.5
react-native-cli: 2.0.1
- **Platform that you're experiencing the issue on**:
- [x] iOS
- [ ] Android
- [ ] **iOS** but have not tested behavior on Android
- [ ] **Android** but have not tested behavior on iOS
- [ ] Both
- **`Firebase` module(s) you're using that has the issue:**
- `Admob`
- **Are you using `TypeScript`?**
- `N`
Think react-native-firebase
is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]
React Native Firebase
and Invertase
on Twitter for updates on the library.This is an install error of some kind. I don't have great luck solving these, they have to do with Xcode search paths, configurations, and pod interaction. There seems to be an infinite number of ways they can go wrong.
So what I've done instead is written a small script that demonstrates clearly that it works: https://github.com/mikehardy/rnfbdemo
I'm not sure what's wrong with your Xcode project, but something is wrong. If you can clone that repo and follow the instructions to run it, you can prove it works in your environment.
Then you can either carefully compare things and line them up, or just obliterate your existing ios structure with a fresh one constructed in the way the script does, and plop your AppDelegate.m code back in it. Sounds brutal but it isn't so bad
Hope this helps
I've tried out the demo twice, but it keeps showing me black screen then it closes itself.
Also, I forgot to say, every time I tried to run my app, I keep getting _Build Failed_ with message
error: PCH was compiled with module cache path '/Users/KuoyHuot/Desktop/React Native/xxx/ios/build/ModuleCache.noindex/147FY0L6K85ZP', but the path is currently '/Users/KuoyHuot/Desktop/React Native/Working/xxx/ios/build/ModuleCache.noindex/147FY0L6K85ZP'
1 error generated.
While building module 'UIKit' imported from /Users/KuoyHuot/Desktop/React Native/Working/xxx/node_modules/react-native/React/Views/UIView+React.h:8:
While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
~~~~~~~~^
2 errors generated.
While building module 'UIKit' imported from /Users/KuoyHuot/Desktop/React Native/Working/xxx/node_modules/react-native/React/Views/UIView+React.h:8:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:9: fatal error: could not build module 'Foundation'
#import <Foundation/Foundation.h>
~~~~~~~^
3 errors generated.
In file included from /Users/KuoyHuot/Desktop/React Native/Working/xxx/node_modules/react-native/React/Views/UIView+React.m:8:
/Users/KuoyHuot/Desktop/React Native/Working/xxx/node_modules/react-native/React/Views/UIView+React.h:8:9: fatal error: could not build module 'UIKit'
#import <UIKit/UIKit.h>
~~~~~~~^
error: PCH was compiled with module cache path '/Users/KuoyHuot/Desktop/React Native/xxx/ios/build/ModuleCache.noindex/147FY0L6K85ZP', but the path is currently '/Users/KuoyHuot/Desktop/React Native/Working/xxx/ios/build/ModuleCache.noindex/147FY0L6K85ZP'
1 error generated.
error: PCH was compiled with module cache path '/Users/KuoyHuot/Desktop/React Native/xxx/ios/build/ModuleCache.noindex/147FY0L6K85ZP', but the path is currently '/Users/KuoyHuot/Desktop/React Native/Working/xxx/ios/build/ModuleCache.noindex/147FY0L6K85ZP'
1 error generated.
6 errors generated.
** BUILD FAILED **
The following build commands failed:
CompileC /Users/KuoyHuot/Desktop/React\ Native/Working/xxx/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/UIView+React.o /Users/KuoyHuot/Desktop/React\ Native/Working/xxx/node_modules/react-native/React/Views/UIView+React.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
But my app still run fine. Could this be the cause? How can I fix this?
I can't comprehend how your app runs while generating build errors.
rnfbdemo wasn't correctly initializing AdMob so it wasn't demonstrating that feature yet.
I just added the AdMob integration fully for iOS so you can see it work.
You are integrating react-native-firebase via pods, which is contrary to the recommendation from the docs - there are so many ways for Xcode projects to go wrong, I can't begin to debug it, but the demonstrator proves it works - you can try it again if you like pulling fresh as I just pushed the full AdMob integration for iOS out there
https://github.com/mikehardy/rnfbdemo does android now too, there are zero problems with AdMob 馃し鈥嶁檪
If you can publish a reproduction on github we can reopen this, but I can't reproduce
@mikehardy I have the same issue with "react-native-firebase": "^5.5.0"
and pod 'Firebase/AdMob', '~> 6.2.0'
(from docs). I've tested your demo with updated pod version and issue is reproduced
@vadimgoroshevsky @Kuoyhout - I've been unable to reproduce this on the latest v5 release of RNFirebase, using Pod version 6.3.0.
If it helps pinpoint a cause I'll explain how this JS error occurs; on iOS to make each module optional, we have a build macro for each module that checks for the existence of a certain header file that indicates that the required dependencies (or Pods) exist in the build (e.g. AdMob), if they don't exist then only an empty stub module is created (e.g. AdMob).
When a module is called in JS it checks to see if the native modules exists or is a stub, at which point it throws the error above.
My guess it's not finding the header files for your project but I can't re-produce this on my end - most likely the <GoogleMobileAds/GADMobileAds.h>
header can't be found on your project somehow.
Same problem. Tried the demo app and ran into the same problem too.
Finally did two things and resolved the problem (both not ideal steps, but seems only way that I could find to make it work):
1) Manually installed the Google Mobile Ads iOS SDK according to Google's official instruction
2) Added the full absolute path of the framework directory (added in step 1) to RNFirebase's "Framework Search Paths", near the bottom of the list but above the original AdMob dir
Have tried many different steps to resolve this problem. Seems these two steps have made it work eventually.
still not sure what made the change but RNFirebase.xcodeproj points to
$(SRCROOT)/../../../ios/Pods/Google-Mobile-Ads-SDK/Frameworks/frameworks
but the actual Admob sdk is here:
$(SRCROOT)/../../../ios/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current
so changing this on the header search path/framework search path solved this issue for me.
If you could propose a pr that would be great this is a big problem for a lot of people
@nadavmos's solution worked for me. I am using the normal Pods setup described in the docs and was receiving the same error. Updating the framework search path in the RNFirebase.xcodeproj worked.
@Salakar we may have a winner here for my most hated / most wish I could have released v5.5 with this working issue...
I had this issue on two different projects. For one project, @Salakar's solution worked. On a separate project, downgrading to pod 'Firebase/Core', '~> 5.20.1
and "react-native-firebase": "^5.4.0"
resolved it. There seems to be a linking issue in the most recent release of RNFirebase.
I confirmed in my demonstrator (https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-rn59.sh#L127) that the comment from @nadavmos worked for me and proposed a PR
Maybe we can get this fixed!
Hey all, v5.5.6 is up with a fix for this from @mikehardy - please give it a go. Thanks
Alright guys, I gave a try for the v5.5.6, with the latest react-native-firebase-starter project.
The issue is still present. I saw that the following search path was appended to the Framework Search Paths in RNFirebase.xcodeproj, but only in Debug part.
$(SRCROOT)/../../../ios/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current
If you replace the previous
$(SRCROOT)/../../../ios/Pods/Google-Mobile-Ads-SDK/Frameworks/frameworks
with the new one, it works. 馃憤
In nutshell, you have to delete the previous value as well.
Interesting.
1- seems like it should be in release as well as debug of course (facepalm for me there)
This deserves a fix, @egunsoma could you PR that to the v5.x.x branch?
2- adding vs replacing shouldn't matter. Specifically: searching for a non-existent path is not an error, but not having a path you need is an error.
So I think this is a red herring. In fact, I think removing the path will remove backwards-compatibility to whatever version of the AdMobs pod switched the path and would then be a breaking change.
For full disclosure - here's how I tested this: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh
You can run it, it works. So I am pretty sure I'm correct on #2 not being a problem. but I did not test release mode, so I'm pretty sure #1 is still a problem.
Prove me wrong :-), I'm still learning all the iOS stuff so if I'm wrong I need to know so I can learn - cheer
I have just tested as @mikehardy suggest #1 and @egunsoma. It is working with scheme 'release'.
So i suspect should be working fine on Production as well.
Thanks every one again.
Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
It is still happening. I just spent an hour figuring out what went wrong ( just production build crash on start ) turn out I missed the log from Xcode > Lot of search > find out this thread > read along and finally fixed it...
Please someone don't just close it, it deserves an update.
@tarouboy is this still a problem when using react-native >= 0.60 and current firebase ios sdks (6.11.0 now) integrated via cocoapods? It's my understanding it works fine with current versions.
@nadavmos Thank you, It worked for me
Just wanted to pipe in and mention I've got two separate RN apps that this is happening with. Usually a clean and re-build of the app works, but not always (seems to be somewhat hit or miss).
Full error details look like this:
*** Terminating app due to uncaught exception 'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized without an application ID. Google AdMob publishers, follow instructions at https://googlemobileadssdk.page.link/admob-ios-update-plist to set a valid application ID. Google Ad Manager publishers, follow instructions at https://googlemobileadssdk.page.link/ad-manager-ios-update-plist.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000113021126 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x0000000112eabf78 objc_exception_throw + 48
2 CoreFoundation 0x0000000113020dc7 -[NSException init] + 0
3 CrashGenius 0x000000010aa4ff7b GADApplicationVerifyPublisherInitializedAnalyticsCorrectly + 414
4 CrashGenius 0x000000010a9fe420 GADEnvironmentIsSupported + 732
5 libdispatch.dylib 0x000000011554b8ac _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x000000011554ca88 _dispatch_client_callout + 8
7 libdispatch.dylib 0x000000011554ef06 _dispatch_queue_override_invoke + 1032
8 libdispatch.dylib 0x000000011555e5b6 _dispatch_root_queue_drain + 351
9 libdispatch.dylib 0x000000011555ef1b _dispatch_worker_thread2 + 135
10 libsystem_pthread.dylib 0x00007fff5dcd89f7 _pthread_wqthread + 220
11 libsystem_pthread.dylib 0x00007fff5dcd7b77 start_wqthread + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'GADInvalidInitializationException', reason: 'The Google Mobile Ads SDK was initialized without an application ID. Google AdMob publishers, follow instructions at https://googlemobileadssdk.page.link/admob-ios-update-plist to set a valid application ID. Google Ad Manager publishers, follow instructions at https://googlemobileadssdk.page.link/ad-manager-ios-update-plist.'
terminating with uncaught exception of type NSException
CoreSimulator 732.17 - Device: iPhone 11 Pro (79DD23BA-BC8E-4573-8598-FDBA587238FF) - Runtime: iOS 14.0 (18A372) - DeviceType: iPhone 11 Pro
I know it's getting merged b/c if I try to manually link my AdMob account it gives me an error that there's a duplicate. Not exactly sure what the fix is here?
Here's the package version for the two apps as well:
1
"@react-native-firebase/admob": "^7.6.6",
"@react-native-firebase/analytics": "^7.6.2",
"@react-native-firebase/app": "^8.4.2",
"@react-native-firebase/crashlytics": "^8.4.4",
"react": "16.13.1",
"react-native": "0.63.2",
2.
"@react-native-firebase/admob": "^7.6.5",
"@react-native-firebase/analytics": "^7.6.1",
"@react-native-firebase/app": "^8.4.0",
"@react-native-firebase/messaging": "^7.8.1",
"react": "16.11.0",
"react-native": "0.62.0",
Most helpful comment
still not sure what made the change but RNFirebase.xcodeproj points to
$(SRCROOT)/../../../ios/Pods/Google-Mobile-Ads-SDK/Frameworks/frameworks
but the actual Admob sdk is here:
$(SRCROOT)/../../../ios/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current
so changing this on the header search path/framework search path solved this issue for me.