多个命令产生错误 - Cocoapods 多个目标和平台

Multiple commands produce error - Cocoapods multiple targets & platforms

我正在构建一个 iOS 应用程序,我想使用最新的 Siri 快捷方式对其进行更新,在设备上构建和测试时一切正常,但在存档时出现错误。

这是我遇到的错误:

error: Multiple commands produce '/Users/tomspee/Library/Developer/Xcode/DerivedData/Company-hhmrvgkwkpelmlewuxvhclfggdtc/Build/Intermediates.noindex/ArchiveIntermediates/Company/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework':
1) Target 'Alamofire-iOS12.0' has create directory command with output '/Users/tomspee/Library/Developer/Xcode/DerivedData/Company-hhmrvgkwkpelmlewuxvhclfggdtc/Build/Intermediates.noindex/ArchiveIntermediates/Company/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework'
2) Target 'Alamofire-iOS10.0' has create directory command with output '/Users/tomspee/Library/Developer/Xcode/DerivedData/Company-hhmrvgkwkpelmlewuxvhclfggdtc/Build/Intermediates.noindex/ArchiveIntermediates/Company/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework'

我有 4 个这样的错误,看起来都一样,但 Pod 不同。

多平台是可以解释的,因为主要项目平台开始 iOS 10.0 但对于 Siri 快捷方式 Intent 和 Intent UI 我需要使用平台 iOS 12.0。但这似乎仍然存在问题。

这是我的 Podfile:

source 'https://github.com/CocoaPods/Specs.git'
source 'https://bitbucket.org/company/company-specs.git'

def sharedPods
  pod 'Alamofire'
  pod 'AlamofireObjectMapper'
  pod 'KeychainSwift'
  pod 'ObjectMapper'
end

target 'Project' do
    platform :ios, '10.0'

    use_frameworks!

    sharedPods

    pod 'AlignedCollectionViewFlowLayout', :git => 'https://github.com/mischa-hildebrand/AlignedCollectionViewFlowLayout.git'
    pod 'Crashlytics'
    pod 'Charts', '3.0.4'
    pod 'Device.swift'
    pod 'Fabric'
    pod 'Firebase/Core'
    pod 'Firebase/Messaging'
    pod 'ImageSlideshow', '~> 1.3'
    pod 'Kanna', :git => 'https://github.com/tid-kijyun/Kanna.git', :branch => 'feature/v4.0.0'
    pod 'MagicalRecord', '2.3.2'
    pod 'CompanySupportLib', '1.1.3'
    pod 'Starscream'
    pod 'SwiftSVG', '~> 2.0'
    pod 'VPAttributedFormat', '1.2.5'
    pod 'youtube-ios-player-helper', '0.1.6'

    target 'ProjectTests' do
        inherit! :search_paths

        pod 'Firebase'
    end
end

target 'Project WatchOS Extension' do
    platform :'watchos', '3.0'

    use_frameworks!

    sharedPods
end

target 'Project Today' do
    platform :ios, '10.0'

    use_frameworks!

    sharedPods
end

target 'Project Intent' do
    platform :ios, '12.0'

    use_frameworks!

    sharedPods
end

target 'Project IntentUI' do
    platform :ios, '12.0'

    use_frameworks!

    sharedPods
end

target 'Project Own Framework' do
    platform :ios, '10.0'

    use_frameworks!

    sharedPods
end

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            config.build_settings['SWIFT_VERSION'] = '4.0'
            if config.build_settings['SDKROOT'] == 'watchos'  
              config.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = '4.0'  
            end
        end
    end
end  

我发现对于 Siri 快捷方式,Intents 和 IntentsUI 目标不需要 platform :ios, '12.0',所以当我将其更改为 platform :ios, '10.0' 时,它删除了重复的框架目标,并且归档问题得到解决。