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.5k stars 2.18k forks source link

[🔥] Fastlane (iOS) error during compile error on this library #7764

Closed KaiValar closed 1 month ago

KaiValar commented 1 month ago

Hello, folks! I'm trying to develop an app in RN (0.73.6)+Expo (SDK 50) with this library just for support Push Notifications. So, I followed the steps detailed on both Getting Started for Android and iOS. On Android, every works fine but, on iOS, I get the following issue during compile process.

Thank you very much in advance!! :D

Issue

`[RUN_FASTLANE] 
❌  (/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/node_modules/@react-native-firebase/app/ios/RNFBApp/RCTConvert+FIRApp.h:18:9)

  16 |  */
  17 | 
> 18 | #import <FirebaseCore/FirebaseCore.h>
     |         ^ include of non-modular header inside framework module 'RNFBApp.RCTConvert_FIRApp': '/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
  19 | #import <React/RCTConvert.h>
  20 | 
  21 | @interface RCTConvert (FIRApp)

[RUN_FASTLANE] 
❌  (/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/node_modules/@react-native-firebase/app/ios/RNFBApp/RCTConvert+FIROptions.h:18:9)

  16 |  */
  17 | 
> 18 | #import <FirebaseCore/FirebaseCore.h>
     |         ^ include of non-modular header inside framework module 'RNFBApp.RCTConvert_FIROptions': '/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
  19 | #import <React/RCTConvert.h>
  20 | 
  21 | @interface RCTConvert (FIROptions)

[RUN_FASTLANE] 
❌  (/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/node_modules/@react-native-firebase/app/ios/RNFBApp/RNFBSharedUtils.h:21:9)

  19 | #define RNFBSharedUtils_h
  20 | 
> 21 | #import <FirebaseCore/FirebaseCore.h>
     |         ^ include of non-modular header inside framework module 'RNFBApp.RNFBSharedUtils': '/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
  22 | #import <React/RCTBridgeModule.h>
  23 | 
  24 | #ifdef DEBUG

[RUN_FASTLANE] 
❌  (node_modules/@react-native-firebase/messaging/ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.m:18:9)

  16 |  */
  17 | 
> 18 | #import <RNFBApp/RNFBRCTEventEmitter.h>
     |         ^ could not build module 'RNFBApp'
  19 | 
  20 | #import "RNFBJSON.h"
  21 | #import "RNFBMessaging+UNUserNotificationCenter.h"

[RUN_FASTLANE] › Compiling @react-native-firebase/messaging Pods/RNFBMessaging » RNFBMessaging+NSNotificationCenter.m
[RUN_FASTLANE] › Compiling @react-native-firebase/messaging Pods/RNFBMessaging » RNFBMessaging+FIRMessagingDelegate.m
[RUN_FASTLANE] › Compiling @react-native-firebase/messaging Pods/RNFBMessaging » RNFBMessaging+AppDelegate.m
[RUN_FASTLANE] ▸ ** ARCHIVE FAILED **
[RUN_FASTLANE] ▸ The following build commands failed:
[RUN_FASTLANE] ▸        CompileC /Users/doble/Library/Developer/Xcode/DerivedData/sesamoApp-ayacsguppnkostgtjeaeldvnueeb/Build/Intermediates.noindex/ArchiveIntermediates/sesamoApp/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/RNFBMessaging.build/Objects-normal/arm64/RNFBMessaging+UNUserNotificationCenter.o /var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/node_modules/@react-native-firebase/messaging/ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNFBMessaging' from project 'Pods')
[RUN_FASTLANE] ▸ (1 failure)
[RUN_FASTLANE] ** ARCHIVE FAILED **
[RUN_FASTLANE] 
[RUN_FASTLANE] 
[RUN_FASTLANE] The following build commands failed:
[RUN_FASTLANE]  CompileC /Users/doble/Library/Developer/Xcode/DerivedData/sesamoApp-ayacsguppnkostgtjeaeldvnueeb/Build/Intermediates.noindex/ArchiveIntermediates/sesamoApp/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/RNFBMessaging.build/Objects-normal/arm64/RNFBMessaging+UNUserNotificationCenter.o /var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/node_modules/@react-native-firebase/messaging/ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNFBMessaging' from project 'Pods')
[RUN_FASTLANE] (1 failure)
[RUN_FASTLANE] Exit status: 65
[RUN_FASTLANE] 
❌  (/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/node_modules/@react-native-firebase/app/ios/RNFBApp/RCTConvert+FIRApp.h:18:9)

  16 |  */
  17 | 
> 18 | #import <FirebaseCore/FirebaseCore.h>
     |         ^ include of non-modular header inside framework module 'RNFBApp.RCTConvert_FIRApp': '/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
  19 | #import <React/RCTConvert.h>
  20 | 
  21 | @interface RCTConvert (FIRApp)

[RUN_FASTLANE] 
❌  (/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/node_modules/@react-native-firebase/app/ios/RNFBApp/RCTConvert+FIROptions.h:18:9)

  16 |  */
  17 | 
> 18 | #import <FirebaseCore/FirebaseCore.h>
     |         ^ include of non-modular header inside framework module 'RNFBApp.RCTConvert_FIROptions': '/var/folders/s9/_2764n4922v6sqlllpk7g6hw0000gn/T/eas-build-local-nodejs/bffa8d34-f654-4218-88fb-036a77649ea3/build/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h' [-Werror,-Wnon-modular-include-in-framework-module]
  19 | #import <React/RCTConvert.h>
  20 | 
  21 | @interface RCTConvert (FIROptions)`

Project Files

Javascript

Not relevant

package.json:

{
  "name": "sesamo-app",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/config-plugins": "^7.9.1",
    "@notifee/react-native": "^7.8.2",
    "@react-native-community/slider": "4.4.2",
    "@react-native-firebase/app": "19.2.2",
    "@react-native-firebase/messaging": "19.2.2",
    "@react-native-material/core": "^1.3.7",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "axios": "^1.6.7",
    "base-64": "^1.0.0",
    "expo": "^50.0.17",
    "expo-application": "^5.8.4",
    "expo-barcode-scanner": "^12.9.3",
    "expo-camera": "^14.1.3",
    "expo-checkbox": "^2.7.0",
    "expo-dev-client": "^3.3.11",
    "expo-device": "^5.9.4",
    "expo-secure-store": "^12.8.1",
    "expo-splash-screen": "^0.26.4",
    "expo-status-bar": "^1.11.1",
    "i18next": "^22.4.15",
    "react": "18.2.0",
    "react-devtools": "^4.27.7",
    "react-i18next": "^12.2.2",
    "react-native": "0.73.6",
    "react-native-background-actions": "^3.0.1",
    "react-native-kontaktio": "^4.1.0",
    "react-native-permissions": "^3.10.1",
    "react-native-radio-buttons-group": "^3.0.1",
    "react-native-safe-area-context": "4.8.2",
    "react-native-screens": "~3.29.0",
    "react-native-select-dropdown": "^3.3.3"
  },
  "plugins": [
    "@notifee/react-native",
    "react-native-permissions",
    {
      "iosPermissions": [
        "Camera",
        "LocationAlways",
        "Notifications"
      ]
    }
  ],
  "devDependencies": {
    "@babel/core": "^7.21.8",
    "babel-eslint": "^10.1.0",
    "eslint-config-standard": "^17.0.0",
    "eslint-config-standard-jsx": "^11.0.0",
    "eslint-config-standard-react": "^13.0.0",
    "eslint-plugin-import": "^2.27.5",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^6.1.1",
    "eslint-plugin-react": "^7.32.2"
  },
  "private": true,
  "eslintConfig": {
    "parser": "babel-eslint",
    "extends": [
      "standard",
      "standard-jsx",
      "standard-react"
    ]
  }
}

firebase.json for react-native-firebase v6:

Not relevant

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking") require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") require 'json' podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {} ENV['RCT_NEW_ARCH_ENABLED'] = podfile_properties['newArchEnabled'] == 'true' ? '1' : '0' ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] = podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR'] def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', "require.resolve( '#{script}', {paths: [process.argv[1]]}, )", __dir__]).strip end # Use it to require both react-native's and this package's scripts: node_require('react-native/scripts/react_native_pods.rb') node_require('react-native-permissions/scripts/setup.rb') platform :ios, '15.0' install! 'cocoapods', :deterministic_uuids => false pod 'Firebase', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'FirebaseMessaging', :modular_headers => true prepare_react_native_project! # ⬇️ uncomment wanted permissions. Esto es para RN-permissions setup_permissions([ # 'AppTrackingTransparency', # 'Bluetooth', # 'Calendars', # 'CalendarsWriteOnly', 'Camera', # 'Contacts', # 'FaceID', # 'LocationAccuracy', 'LocationAlways', # 'LocationWhenInUse', # 'MediaLibrary', # 'Microphone', # 'Motion', 'Notifications', # 'PhotoLibrary', # 'PhotoLibraryAddOnly', # 'Reminders', # 'Siri', # 'SpeechRecognition', # 'StoreKit', ]) # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. # because `react-native-flipper` depends on (FlipperKit,...), which will be excluded. To fix this, # you can also exclude `react-native-flipper` in `react-native.config.js` # # ```js # module.exports = { # dependencies: { # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), # } # } # ``` flipper_config = FlipperConfiguration.disabled if ENV['NO_FLIPPER'] == '1' then # Explicitly disabled through environment variables flipper_config = FlipperConfiguration.disabled elsif podfile_properties.key?('ios.flipper') then # Configure Flipper in Podfile.properties.json if podfile_properties['ios.flipper'] == 'true' then flipper_config = FlipperConfiguration.enabled(["Debug", "Release"]) elsif podfile_properties['ios.flipper'] != 'false' then flipper_config = FlipperConfiguration.enabled(["Debug", "Release"], { 'Flipper' => podfile_properties['ios.flipper'] }) end end target 'sesamoApp' do use_expo_modules! config = use_native_modules! use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS'] use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true use_react_native!( :path => config[:reactNativePath], :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes', # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/..", # Note that if you have use_frameworks! enabled, Flipper will not work if enabled #:flipper_configuration => flipper_config # Esto es comentado porque no es compatible con RN-firebase ) post_install do |installer| react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) # This is necessary for Xcode 14, because it signs resource bundles by default # when building for devices. installer.target_installation_results.pod_target_installation_results .each do |pod_name, target_installation_result| target_installation_result.resource_bundle_targets.each do |resource_bundle_target| resource_bundle_target.build_configurations.each do |config| config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' end end end end post_integrate do |installer| begin expo_patch_react_imports!(installer) rescue => e Pod::UI.warn e end end end ``` #### `AppDelegate.mm`: ```objc #import "AppDelegate.h" #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.moduleName = @"main"; [FIRApp configure]; // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{}; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { return [self getBundleURL]; } - (NSURL *)getBundleURL { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } // Linking API - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options]; } // Universal Links - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { return [super application:application didFailToRegisterForRemoteNotificationsWithError:error]; } // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; } @end ```


Environment

Click To Expand

**`react-native info` output:** On Expo, there isn't this command, but this another called expo-env-info for get this info (CPU is an M1): ``` expo-env-info 1.2.0 environment info: System: OS: macOS 14.4.1 Shell: 5.9 - /bin/zsh Binaries: Node: 21.6.1 - /opt/homebrew/bin/node npm: 10.3.0 - /opt/homebrew/bin/npm Managers: CocoaPods: 1.14.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4 IDEs: Xcode: 15.3/15E204a - /usr/bin/xcodebuild npmPackages: expo: ^50.0.17 => 50.0.17 react: 18.2.0 => 18.2.0 react-native: 0.73.6 => 0.73.6 npmGlobalPackages: eas-cli: 7.8.2 Expo Workflow: bare ``` - **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 - **`react-native-firebase` version you're using that has this issue:** - `19.2.2` - **Are you using `TypeScript`?** - No.


KaiValar commented 1 month ago

Oh, crap, I found the problem. I installed the pods for Firebase services as Firebase docs said, but it's problematic because GoogleServices needs to be modular but this library needs it non modular... I guess you fixed it and includes on lib ready to go.

Yeah, I'm stupid ^^'

Closing this.

ZouwenSB commented 1 month ago

@KaiValar hi, I've ran into the same issue, but couldn't understand from your comment what you did to make it work, could you please elaborate?

KaiValar commented 1 month ago

@KaiValar hi, I've ran into the same issue, but couldn't understand from your comment what you did to make it work, could you please elaborate?

Hello there!

If you are installing Firebase throught CocoaPods, just remove it, because library already includes Firebase ready to work and you are installing another ones. I just removed the pods and everything works fine :D

This lines in podfile were the root of the error in my case.

pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseMessaging', :modular_headers => true