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

时间:2018-10-23 07:53:05

标签: ios swift cocoapods xcode10 ios12

我正在构建一个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  

1 个答案:

答案 0 :(得分:1)

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