You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

配置Firebase后React Native iOS应用无法构建求助

为iOS应用配置Firebase后构建失败求助

构建时终端输出如下信息:

Prepare packages

Computing target dependency graph and provisioning inputs

Create build description
Build description signature: 5b4e366011110c238ef7eb0e2f1dc896
Build description path: /Users/ali/Library/Developer/Xcode/DerivedData/Cypien-fzcypiyubvmmrxeseqhayuvqdhfm/Build/Intermediates.noindex/XCBuildData/5b4e366011110c238ef7eb0e2f1dc896-desc.xcbuild

note: Building targets in dependency order
note: Removed stale file '/Users/ali/Library/Developer/Xcode/DerivedData/Cypien-fzcypiyubvmmrxeseqhayuvqdhfm/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/fmt.build/Script-46EB2E0001F240.sh'
....

已尝试以下方案但均未解决问题:

  • 严格按照官方文档步骤配置
  • 降级相关依赖版本
  • 参考社区相关文章、GitHub问题及Stack Overflow方案
  • 移除Firebase依赖后应用可正常构建

配置信息

Podfile

target 'Cypien' 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()
  pod 'Firebase', :modular_headers => true
  pod 'FirebaseCoreInternal', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  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}/.."
  )
end

App Delegate文件

#import <Firebase.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } // for Firebase
  self.moduleName = @"Cypien";
  // 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 = @{};
  bool didFinish=[super application:application didFinishLaunchingWithOptions:launchOptions];
  [RNSplashScreen show];  // here 
  return didFinish;
}

Package.json

{
    "react": "18.2.0",
    "react-native": "0.71.11",
    "@react-native-firebase/app": "^15.6.0",
    "@react-native-firebase/messaging": "^15.6.0"
}

还执行了以下命令:

  • pod install --repo-update
  • pod install
  • pod deintegrate
  • 删除Podfile并重新生成
  • 清理Xcode构建缓存
  • 重启电脑

问题仍未解决,请求技术帮助。

内容的提问来源于stack exchange,提问作者Akif Kara

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 19:40:56