XCode 中的 Flutter 项目:“多个命令生成...FBSDKCoreKit.framework”

Ced*_*ric 5 xcode ios fbsdk flutter

我将 iOS 升级到 16.4.1(这需要我将 XCode 升级到 14.3,这需要我将 mac 操作系统从 12 升级到 13)后,在尝试构建 iOS Flutter 应用程序时收到此错误:

\n
\n

多个命令生成 \'/Users//Library/Developer/Xcode/DerivedData/Runner-bczatismiambuefczuntppsiskse/Build/Products/Debug-iphoneos/Runner.app/Frameworks/FBSDKCoreKit.framework\'

\n

目标\'Runner\'(项目\'Runner\')具有来自\'/Users//Documents/AndroidStudioProjects//ios/Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework\'的复制命令到 \'/Users/<我的名称/Library/Developer/Xcode/DerivedData/Runner-bczatismiambuefczuntppsiskse/Build/Products/Debug-iphoneos/Runner.app/Frameworks/FBSDKCoreKit.framework\'

\n

该命令取决于目标\'Runner\'(项目\'Runner\')中的命令:脚本阶段\xe2\x80\x9c[CP] Embed Pods Frameworks\xe2\x80\x9d

\n
\n

我还没有添加任何新的软件包、pod、插件……就在我的 iOS 和 Mac OS(和 XCode)更新之后,我收到了这个错误。

\n

我已经检查了这个 stackoverflow 问题,这对我没有帮助。

\n

错误消息提到了\xe2\x80\x9c[CP] Embed Pods Frameworks\xe2\x80\x9d这里是Build PhasesXCode 中的屏幕截图:

\n

在此输入图像描述

\n

这是我的 XCode 中“构建阶段”>“复制捆绑资源”部分的屏幕截图(如果有的话)。(Info.plist里面没有)

\n

在此输入图像描述

\n
\n

我的 Pod 文件:

\n
# Uncomment this line to define a global platform for your project\nplatform :ios, \'13.0\'\n\n# CocoaPods analytics sends network stats synchronously affecting flutter build latency.\nENV[\'COCOAPODS_DISABLE_STATS\'] = \'true\'\n\nproject \'Runner\', {\n  \'Debug\' => :debug,\n  \'Profile\' => :release,\n  \'Release\' => :release,\n}\n\ndef flutter_root\n  generated_xcode_build_settings_path = File.expand_path(File.join(\'..\', \'Flutter\', \'Generated.xcconfig\'), __FILE__)\n  unless File.exist?(generated_xcode_build_settings_path)\n    raise "#{generated_xcode_build_settings_path} must exist. If you\'re running pod install manually, make sure flutter pub get is executed first"\n  end\n\n  File.foreach(generated_xcode_build_settings_path) do |line|\n    matches = line.match(/FLUTTER_ROOT\\=(.*)/)\n    return matches[1].strip if matches\n  end\n  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"\nend\n\nrequire File.expand_path(File.join(\'packages\', \'flutter_tools\', \'bin\', \'podhelper\'), flutter_root)\n\nflutter_ios_podfile_setup\n\n#install! \'cocoapods\', :disable_input_output_paths => true #didn\'t work from https://github.com/flutter/flutter/issues/20685\n\ntarget \'Runner\' do\n  use_frameworks!\n  use_modular_headers!\n\n  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))\n  \n  \n  # pods for firebase: //firebase: https://firebase.google.com/docs/ios/setup?authuser=0#available-pods\n  # Add the Firebase pod for Google Analytics\n  pod \'FirebaseAnalytics\'\n\n  # For Analytics without IDFA collection capability, use this pod instead\n  # pod \xe2\x80\x98Firebase/AnalyticsWithoutAdIdSupport\xe2\x80\x99\n\n  # Add the pods for any other Firebase products you want to use in your app\n  # For example, to use Firebase Authentication and Cloud Firestore\n  pod \'FirebaseAuth\'\n  pod \'GoogleSignIn\'\n  pod \'FBSDKCoreKit\' # /sf/ask/4200405541/#answer-61751523\n  pod \'FBSDKLoginKit\' #<- only this one is mentioned in the docs: https://developers.facebook.com/apps/828723188239449/fb-login/quickstart/?sdk=cocoapods\n  pod \'FirebaseFirestore\'\n  pod \'FirebaseFunctions\'\n  pod \'FirebaseAppCheck\'\n  \nend\n\npost_install do |installer|\n  installer.pods_project.targets.each do |target|\n    flutter_additional_ios_build_settings(target)\n  end\n  \n#  installer.generated_projects.each do |project|\n#    project.targets.each do |target|\n#      target.build_configurations.each do |config|\n#          config.build_settings[\'IPHONEOS_DEPLOYMENT_TARGET\'] = \'13.0\'\n#       end\n#    end\n#  end\n\n#  post_install do |installer|\n#    installer.pods_project.targets.each do |target|\n#      target.build_configurations.each do |config|\n#        # drop deployment target so it works with ios14\n#        config.build_settings.delete \'IPHONEOS_DEPLOYMENT_TARGET\'\n#      end\n#    end\n#  end\n  \n#  post_install do |installer|\n#    installer.pods_project.targets.each do |target|\n#      flutter_additional_ios_build_settings(target)\n#      target.build_configurations.each do |config|\n#        config.build_settings[\'IPHONEOS_DEPLOYMENT_TARGET\'] = \'13.0\'\n#      end\n#    end\n#  end\n\nend\n
Run Code Online (Sandbox Code Playgroud)\n
\n

我的 AppDelegate.swift 文件:

\n
import UIKit\nimport Flutter\n\n//firebase: https://firebase.google.com/docs/ios/setup?authuser=0#available-pods\nimport FirebaseCore\n\nimport FirebaseAnalytics\n\nimport FirebaseAuth\n//OAuth:\nimport GoogleSignIn\n//import FacebookCore //from the official docs: https://developers.facebook.com/docs/facebook-login/ios#delegate\nimport FBSDKCoreKit //correction: /sf/ask/4200405541/#answer-61751523\nimport FBSDKLoginKit\n\nimport FirebaseFirestore\nimport FirebaseFunctions\n\n@UIApplicationMain\n@objc class AppDelegate: FlutterAppDelegate {\n  override func application(\n    _ application: UIApplication,\n    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?\n  ) -> Bool {\n      \n      //from https://firebase.google.com/docs/app-check/flutter/debug-provider?authuser=0&hl=en#apple_platforms\n#if DEBUG\n    let providerFactory = AppCheckDebugProviderFactory()\n    AppCheck.setAppCheckProviderFactory(providerFactory)\n#endif\n      \n    GeneratedPluginRegistrant.register(with: self)\n    \n    // Use Firebase library to configure APIs\n//    FirebaseApp.configure() //-> Exception: Thread 1: "Default app has already been configured."\n    if (FirebaseApp.app()==nil){\n      FirebaseApp.configure()\n    }\n    \n    return super.application(application, didFinishLaunchingWithOptions: launchOptions)\n  }\n}\n
Run Code Online (Sandbox Code Playgroud)\n
\n

编辑:我添加了额外的屏幕截图,显示项目中名为“Info.plist”的每个文件(通过 Mac OS Finder 搜索)。

\n

第一个屏幕截图显示了主 Info.plist 文件。\n在此输入图像描述

\n
\n

在第二个屏幕截图中,您可以在同一项目中看到 9 个 Info.plist 文件,但它们都在 Pod 内:

\n
    \n
  • FBSDK核心套件
  • \n
  • Google-移动广告-SDK
  • \n
  • FBSDK登录工具包
  • \n
  • Google用户消息平台
  • \n
  • FBAEM套件
  • \n
  • Firebase分析
  • \n
  • 谷歌应用测量
  • \n
  • FBSDKCoreKit_基础知识
  • \n
  • GoogleAppMeasurement(在另一个文件夹内,如上面 2 行)
  • \n
\n

在此输入图像描述

\n

我的flutter doctor输出:

\n

在此输入图像描述

\n

Qua*_* L. 0

首先,尝试清洁 Pod:

flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile
flutter run
Run Code Online (Sandbox Code Playgroud)