多个命令产生 - CocoaPods 每个目标的不同 iOS 版本

时间:2021-02-09 11:53:30

标签: firebase cocoapods

从 Firebase 7.4.0 更新到 Firebase 7.5.0 时出现以下错误

Multiple commands produce '/Users/redacted/Library/Developer/Xcode/DerivedData/MyApp-anpbtbokxviinkeqjaakixizzscs/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/FirebaseAnalytics':
1) That command depends on command in Target 'FirebaseAnalytics-iOS12.0' (project 'Pods'): script phase “[CP] Copy XCFrameworks”
2) That command depends on command in Target 'FirebaseAnalytics-iOS14.0' (project 'Pods'): script phase “[CP] Copy XCFrameworks”

我的应用(最低 iOS 12.0)有一个 AppClip 目标(最低 iOS 14.0)。

这是我的 Podfile

inhibit_all_warnings!
use_frameworks!

def shared_pod
  pod 'GoogleUtilities' #Or else iMessage crashes
  pod 'GTMSessionFetcher'
  pod 'Firebase/Auth'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Core'
  pod 'Firebase/Analytics'
  pod 'Firebase/Crashlytics'
end

target 'AppClip' do
  platform :ios, '14.0'
  shared_pod
end

target 'MyApp' do
  platform :ios, '12.0'
  pod 'Firebase/Performance'
  pod 'Firebase/AdMob'
  shared_pod
end
   

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end

1 个答案:

答案 0 :(得分:0)

我发现的最佳解决方案是全局设置较低的最小目标。

这是正确的 Podfile

platform :ios, '12.0'
inhibit_all_warnings!
use_frameworks!


def shared_pod
  pod 'GoogleUtilities' #Or else iMessage crashes
  pod 'GTMSessionFetcher'
  pod 'Firebase/Auth'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Core'
  pod 'Firebase/Analytics'
  pod 'Firebase/Crashlytics'
end

target 'AppClip' do
  shared_pod
end

target 'MyApp' do
  pod 'Firebase/Performance'
  pod 'Firebase/AdMob'
  shared_pod
end
   

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
  end
end

结束

相关问题