Describe your issue here
After performing all steps from the migration docs, I'm hitting this issue:
You attempted to use a firebase module that's not installed natively on your iOS project by calling firebase.auth().
Ensure you have either linked the module or added it to your projects Podfile.
See http://invertase.link/ios for full setup instructions.
Of course, I've tried to manually link it but so far it has not changed the result and I continue to receive this error.
I tried removing node_modules, Pods, Build, and Podfile.lock (before reinstalling/rebuilding them all). I've looked at mikehardy's demobuild script, no luck there either.
I didn't need to add anything new to AppDelegate.m, all of the data needed was already there (e.g. the [FIRApp configure] and import lines).
I am trying to do this in my main component:
import firebase from '@react-native-firebase/app';
import '@react-native-firebase/auth';
import '@react-native-firebase/firestore';
import '@react-native-firebase/storage';
When I go to use it, I receive the error. When I try to do import auth from '@react-native-firebase/auth' and then try to use auth() directly, I still get it. I know the module is there as I print auth out with console.log(auth) and the component is visible.
I tried to Add Files to Project -> RNFBApp -> Build Phases -> tried adding the RNFB file but that caused a build error so I removed those.
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 'Tabs' do
# Pods for Tabs
pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
pod 'Fabric', '~> 1.10.2'
pod 'Crashlytics', '~> 3.13.2'
pod 'GoogleSignIn', '~> 5'
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'RCTImage',
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'TwitterKit'
pod 'RNFS', :path => '../node_modules/react-native-fs'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'react-native-blur', :path => '../node_modules/@react-native-community/blur'
end
target 'Tabs-tvOS' do
target 'Tabs-tvOSTests' do
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
# The following is needed to ensure the "archive" step works in XCode.
# It removes React & Yoga from the Pods project, as it is already included in the main project.
# Without this, you'd see errors when you archive like:
# "Multiple commands produce ... libReact.a"
# "Multiple commands produce ... libyoga.a"
targets_to_ignore = %w(React yoga)
if targets_to_ignore.include? target.name
target.remove_from_project
end
end
end
#### `AppDelegate.m`:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h>
#import <TwitterKit/TWTRKit.h>
@implementation AppDelegate
#define TWITTER_SCHEME @"twitterkit-xyz"
#define TWITTER_SCHEME_LOWER @"twitterkit-xyz"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"Tabs"
initialProperties:nil];
// [[Twitter sharedInstance] startWithConsumerKey:TWITTER_SCHEME consumerSecret:TWITTER_SECRET];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
NSURL *jsUrl = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
[[RCTBundleURLProvider sharedSettings] setJsLocation:jsUrl.host];
return jsUrl;
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
if ([[url scheme] isEqualToString:TWITTER_SCHEME]) {
NSLog(@"This one doesn't work");
return [[Twitter sharedInstance] application:app openURL:url options:options];
}
if ([[url scheme] isEqualToString:TWITTER_SCHEME_LOWER]) {
NSLog(@"This one is fine");
return [[Twitter sharedInstance] application:app openURL:url options:options];
}
return NO;
}
@end
react-native info output:
React Native Environment Info:
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Memory: 207.21 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.3 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
IDEs:
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: ^0.59.9 => 0.59.10
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-firebase version you're using that has this issue:Firebase module(s) you're using that has the issue:TypeScript?Yeah, my demo script is still for RNFB v5, it doesn't help here sorry
Don't you still need to include the RNFB modules as pods though?
Mr. Hardy, you are a goddamn saint. Thank you sir.
This really needs to be added to the migration documentation!
Excellent - glad that helped :-) - there's an edit button at the top of each page on the doc site I think, and the github UI makes doing trivial things like doc updates easy (they auto-fork/auto-branch for you and set you up for the PR so it's painless) - I just read it (I haven't migrated yet, so it's my first read) and I think somewhere near the specific module installation section is a good spot https://invertase.io/oss/react-native-firebase/migrating-to-v6 / https://github.com/invertase/react-native-firebase/edit/docs/pages/migrating-to-v6.md
If you have autolinking setup then you don't need to add it to your podfile, they're automatically detected, so this only applies if you haven't setup autolinking - which I can see is missing from your Podfile.
I think the manual installation docs do already cover this, maybe a small snippet needs adding to the migration guide too, as above.
@Salakar he's on RN59
@Salakar he's on RN59
馃檲 missed that, my bad
I encountered this error message because I still had 'Firebase/Auth', '~> 5.20.1' in the Podfile. After changing it to 'Firebase/Auth', '~> 6.3.0' and running pod install it started working.
Should be on 6.10 at any rate (current)
I have same issue on TestFlight only. Has anyone solved a problem?
Fatal Exception: RCTFatalException: Unhandled JS Exception: Error: Error: You attempted to use a firebase module that's not installed natively on your iOS project by calling firebase.auth(). 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/Auth'" to your Podfile See http://invertase.link/ios for full setup instructions.
"react": "16.8.3",
"react-native": "^0.59.9",
"react-native-firebase": "^5.5.6"
My pod file looking:
platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'project' do
use_frameworks!
pod 'GoogleSignIn', '~> 4.4.0'
pod 'FBSDKCoreKit', '~> 4.39.0'
pod 'FBSDKLoginKit', '~> 4.39.0'
pod 'FBSDKShareKit', '~> 4.39.0'
pod 'DCTAuth', :git => 'https://github.com/danielctull/DCTAuth.git'
pod 'Firebase/Core', '~> 6.3.0'
pod 'Firebase/Auth', '~> 6.3.0'
pod 'Firebase/Messaging', '~> 6.3.0'
pod 'Fabric'
pod 'Crashlytics'
target 'projectTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'project-tvOS' do
target 'project-tvOSTests' do
inherit! :search_paths
end
end
post_install do |installer|
system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")
system("mkdir -p Pods/Headers/Private/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Private/* Pods/Headers/Public/FirebaseCore/")
system("mkdir -p Pods/Headers/Private/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Private/* Pods/Headers/Private/FirebaseCore/")
end
@Puvvl it has been my experience that differences between debug and release builds like that are Xcode caching issues. I have a great deal of cleaning during release builds in order to avoid these. I call this package.json deep-clean target from fastlane before running the build
"deep-clean": "./node_modules/.bin/react-native-clean-project --keep-node-modules --remove-iOS-build --keep-brew --keep-pods --remove-iOS-pods --remove-android-build && yarn clean",
"clean": "\\rm -fr ./node_modules && \\rm -fr dist/* && \\rm -fr ios/build ios/Pods ios/KScoreApp.xcarchive && \\rm -fr android/build android/app/build",
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.
Hi,
I am getting the same error : "You attempted to use a firebase module that's not installed natively on your iOS project by calling firebase.auth()" for my production and staging build. I am on RN60 and react native firebase version 5.5.6. My pod file has pod 'Firebase/Core', '~> 6.3.0'
pod 'Firebase/Storage', '~> 6.3.0'
pod 'Firebase/Auth', '~> 6.3.0'. I have tried cleaning the node_module, pod install, pod update etc.. The other 2 module core and storage work fine, I don't get any errors for them. On the development server i.e. on Xcode Simulator it is working fine most of the times, but sometimes I also get the same error message there as well. Can someone please guide me and help me resolve this issue. What could be the reason for seeing this error?
Thanks,
Minu
@minuhariharan I am in the same situation, same versions and everything but using Firebase/Messaging instead. Same errors.
I tried everything using pod version 6.11.0 for Firebase Auth as well but no success, hope someone is able to give some pointers, this is breaking our app for production. It works fine for android, only failing for iOS.
@minuhariharan you should open a new issue, carefully filling out all the information in the template. In general though I will say the answer to why your project failing will be in the difference between the result of this script https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh and your project, possibly connected with build staleness that would be blown out with this https://github.com/invertase/react-native-firebase/issues/2697#issuecomment-545879555
@mikehardy Thank you will open a new issue
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.
Most helpful comment
I encountered this error message because I still had
'Firebase/Auth', '~> 5.20.1'in the Podfile. After changing it to'Firebase/Auth', '~> 6.3.0'and running pod install it started working.