Closed Upsite-cor closed 8 months ago
Hello everyone, I'm pleased to share that I've successfully resolved the issue, and my app is now running smoothly. The problem emerged after updating to version 18.0.0 or higher of the Firebase dependencies, causing compatibility issues with iOS SDK version 10.4.0. To address this, I found a solution by updating the iOS SDK version to 10.21.0, effectively resolving the initial problem.
For those experiencing a similar issue, ensure you update the following line in your ios/Podfile to match your Firebase React Native version, as shown below:
ruby
$FirebaseSDKVersion = '10.21.0' # for Firebase
This adjustment worked for me, but keep in mind that its effectiveness for others may vary.
Glad you got things working for your project! However, for future readers and perhaps for your project now:
This:
$FirebaseSDKVersion = '10.21.0' # for Firebase
Is not necessary. It's an emergency escape hatch for people that really really really need a different version of Firebase than the one we automatically depend on and which projects normally get for free transitively https://github.com/invertase/react-native-firebase/blob/9e9255a8845b1f3f28fb77b0a3b032c13958593f/packages/app/package.json#L76
If you include that override line in your Podfile, you are responsible for handling all breaking changes and compatibility issues and you will likely end up with problems like this in the future again. I can't recommend it for long term use, only in emergency cases, temporarily, when you know what you are doing. Otherwise it is at your own risk as explicitly noted in the documentation: https://rnfirebase.io/#overriding-native-sdk-versions
Using your own SDK versions is generally not recommended as it can lead to breaking changes in your application. Proceed with caution.
Issue
Hey everyone, I'm facing a critical issue that's preventing me from successfully building my iOS app. Interestingly, this problem is unique to iOS and doesn't affect the Android build. Despite extensive research, I haven't been able to find a solution that works. I attempted a fix suggested in this GitHub issue: https://github.com/CocoaPods/CocoaPods/issues/11477, thinking it might be related to CocoaPods, but unfortunately, it didn't resolve the issue. I've included the warnings and errors printed by the terminal after running yarn ios below. Any help would be greatly appreciated.
Project Files
Javascript
Click To Expand
#### `package.json`: ```json { "name": "Growthbook", "version": "1.1.0", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest", "postversion": "react-native-version --never-amend", "updateVersion": "yarn version --no-git-tag-version" }, "dependencies": { "@invertase/react-native-apple-authentication": "^2.2.2", "@react-native-async-storage/async-storage": "^1.17.11", "@react-native-community/slider": "^4.4.2", "@react-native-firebase/app": "^18.8.0", "@react-native-firebase/auth": "^18.8.0", "@react-native-firebase/firestore": "^18.8.0", "@react-native-firebase/storage": "^18.8.0", "@react-native-google-signin/google-signin": "^9.0.2", "@react-navigation/bottom-tabs": "^6.5.5", "@react-navigation/native": "^6.1.4", "@react-navigation/native-stack": "^6.9.10", "@reduxjs/toolkit": "^1.9.3", "appcenter": "^4.4.5", "appcenter-analytics": "^4.4.5", "appcenter-crashes": "^4.4.5", "formik": "^2.2.9", "react": "18.2.0", "react-native": "0.71.3", "react-native-animatable": "^1.3.3", "react-native-blob-util": "^0.17.1", "react-native-fbsdk-next": "^11.1.0", "react-native-get-random-values": "^1.8.0", "react-native-image-picker": "^5.1.0", "react-native-pdf": "^6.6.2", "react-native-prompt-android": "^1.1.0", "react-native-safe-area-context": "^4.5.0", "react-native-screens": "^3.20.0", "react-native-track-player": "^3.2.0", "react-native-vector-icons": "^9.2.0", "react-redux": "^8.0.5", "redux": "^4.2.1", "uuid": "^9.0.0", "yup": "^1.0.0" }, "devDependencies": { "@babel/core": "^7.21.0", "@babel/preset-env": "^7.14.0", "@babel/runtime": "^7.21.0", "@react-native-community/eslint-config": "^3.0.0", "@tsconfig/react-native": "^2.0.2", "@types/jest": "^29.4.0", "@types/react": "^18.0.28", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.4.3", "eslint": "^8.34.0", "jest": "^29.4.3", "metro-react-native-babel-preset": "0.75.0", "prettier": "^2.8.4", "react-native-version": "^4.0.0", "react-test-renderer": "18.2.0", "typescript": "4.9.5" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, min_ios_version_supported prepare_react_native_project! flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end target 'Growthbook' do config = use_native_modules! use_frameworks! :linkage => :static # for Firebase $RNFirebaseAsStaticFramework = true # for Firebase # Flags change depending on the env values. flags = get_default_flags() use_react_native!( :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. # Upcoming versions of React Native may rely on get_default_flags(), but # we make it explicit here to aid in the React Native upgrade process. :hermes_enabled => flags[:hermes_enabled], :fabric_enabled => flags[:fabric_enabled], # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. # :flipper_configuration => flipper_config, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) $FirebaseSDKVersion = '10.4.0' # for Firebase target 'GrowthbookTests' do inherit! :complete # Pods for testing end post_install do |installer| react_native_post_install( installer, # Set `mac_catalyst_enabled` to `true` in order to apply patches # necessary for Mac Catalyst builds :mac_catalyst_enabled => false ) __apply_Xcode_12_5_M1_post_install_workaround(installer) # for Firebase (all below) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0' config.build_settings["GCC_WARN_INHIBIT_ALL_WARNINGS"] = "YES" end end installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings["CC"] = "clang" config.build_settings["LD"] = "clang" config.build_settings["CXX"] = "clang++" config.build_settings["LDPLUSPLUS"] = "clang++" end end installer.aggregate_targets.each do |aggregate_target| aggregate_target.user_project.native_targets.each do |target| target.build_configurations.each do |config| config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES' config.build_settings['EXCLUDED_ARCHS'] = 'i386' end end aggregate_target.user_project.save end installer.pods_project.targets.each do |target| if (target.name.eql?('FBReactNativeSpec')) target.build_phases.each do |build_phase| if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs')) target.build_phases.move(build_phase, 0) end end end end installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings["ENABLE_BITCODE"] = "NO" end end end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import
#import
#import
#import
#import
#import
#import
#import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[AppCenterReactNative register];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];
[FIRApp configure];
self.moduleName = @"Growthbook";
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary *)options
{
if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) {
return YES;
}
if([RNGoogleSignin application:app openURL:url options:options]){
return YES;
}
if ([RCTLinkingManager application:app openURL:url options:options]) {
return YES;
}
return NO;
}
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
///
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
- (BOOL)concurrentRootEnabled
{
return true;
}
@end
```
Environment
Click To Expand
**`react-native info` output:** ``` OUTPUT GOES HERE OS: macOS 14.2.1 CPU: (8) arm64 Apple M1 Memory: 108.59 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 21.6.1 - /opt/homebrew/bin/node Yarn: 1.22.21 - /opt/homebrew/bin/yarn npm: 10.2.4 - /opt/homebrew/bin/npm Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.14.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2 Android SDK: API Levels: 33, 34 Build Tools: 30.0.3, 33.0.0, 33.0.1, 34.0.0 System Images: android-33 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2023.1 AI-231.9392.1.2311.11330709 Xcode: 15.2/15C500b - /usr/bin/xcodebuild Languages: Java: 17.0.10 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.3 => 0.71.3 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [x] iOS - **`react-native-firebase` version you're using that has this issue:** - `10.4.0` - **`Firebase` module(s) you're using that has the issue:** - `It seems that Firestore is having issues according to the logs` - **Are you using `TypeScript`?** - No
React Native Firebase
andInvertase
on Twitter for updates on the library.