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

问题描述 投票:0回答:2

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


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

目标“Runner”(项目“Runner”)已将命令从“/Users//Documents/AndroidStudioProjects//ios/Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework”复制到“/Users/”

该命令取决于目标“Runner”(项目“Runner”)中的命令:脚本阶段“[CP] Embed Pods Frameworks”


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

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

错误消息提到了

“[CP] Embed Pods Frameworks”
,所以这是 XCode 中
Build Phases
下的屏幕截图:

如果重要的话,这是我的 XCode 中“构建阶段”>“复制捆绑资源”部分的屏幕截图。 (那里没有

Info.plist


我的 Podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

#install! 'cocoapods', :disable_input_output_paths => true #didn't work from https://github.com/flutter/flutter/issues/20685

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  
  
  # pods for firebase: //firebase: https://firebase.google.com/docs/ios/setup?authuser=0#available-pods
  # Add the Firebase pod for Google Analytics
  pod 'FirebaseAnalytics'

  # For Analytics without IDFA collection capability, use this pod instead
  # pod ‘Firebase/AnalyticsWithoutAdIdSupport’

  # Add the pods for any other Firebase products you want to use in your app
  # For example, to use Firebase Authentication and Cloud Firestore
  pod 'FirebaseAuth'
  pod 'GoogleSignIn'
  pod 'FBSDKCoreKit' # https://stackoverflow.com/questions/60005793/no-such-module-facebookcore-in-swift-5#answer-61751523
  pod 'FBSDKLoginKit' #<- only this one is mentioned in the docs: https://developers.facebook.com/apps/828723188239449/fb-login/quickstart/?sdk=cocoapods
  pod 'FirebaseFirestore'
  pod 'FirebaseFunctions'
  pod 'FirebaseAppCheck'
  
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
  
#  installer.generated_projects.each do |project|
#    project.targets.each do |target|
#      target.build_configurations.each do |config|
#          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
#       end
#    end
#  end

#  post_install do |installer|
#    installer.pods_project.targets.each do |target|
#      target.build_configurations.each do |config|
#        # drop deployment target so it works with ios14
#        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
#      end
#    end
#  end
  
#  post_install do |installer|
#    installer.pods_project.targets.each do |target|
#      flutter_additional_ios_build_settings(target)
#      target.build_configurations.each do |config|
#        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
#      end
#    end
#  end

end

我的 AppDelegate.swift 文件:

import UIKit
import Flutter

//firebase: https://firebase.google.com/docs/ios/setup?authuser=0#available-pods
import FirebaseCore

import FirebaseAnalytics

import FirebaseAuth
//OAuth:
import GoogleSignIn
//import FacebookCore //from the official docs: https://developers.facebook.com/docs/facebook-login/ios#delegate
import FBSDKCoreKit //correction: https://stackoverflow.com/questions/60005793/no-such-module-facebookcore-in-swift-5#answer-61751523
import FBSDKLoginKit

import FirebaseFirestore
import FirebaseFunctions

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
      
      //from https://firebase.google.com/docs/app-check/flutter/debug-provider?authuser=0&hl=en#apple_platforms
#if DEBUG
    let providerFactory = AppCheckDebugProviderFactory()
    AppCheck.setAppCheckProviderFactory(providerFactory)
#endif
      
    GeneratedPluginRegistrant.register(with: self)
    
    // Use Firebase library to configure APIs
//    FirebaseApp.configure() //-> Exception: Thread 1: "Default app has already been configured."
    if (FirebaseApp.app()==nil){
      FirebaseApp.configure()
    }
    
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

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

第一个屏幕截图显示了主要的 Info.plist 文件。


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

  • FBSDKCoreKit
  • Google-移动广告-SDK
  • FBSDK登录套件
  • Google 用户消息平台
  • FBAEM套件
  • Firebase 分析
  • GoogleAppMeasurement
  • FBSDKCoreKit_基础知识
  • GoogleAppMeasurement(在另一个文件夹内,如上面 2 行)

我的

flutter doctor
输出:

ios flutter xcode fbsdk
2个回答
0
投票

首先,尝试清洁烟弹:

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

0
投票

在 xcode 中打开您的项目,然后转到项目目标中的常规,向下滚动到框架、库和嵌入内容,然后将 FBSDKCoreKit.xcframework 从“嵌入并签名”更改为“不嵌入”,这应该可以解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.