Search code examples
iosswiftcocoapodsxcode10ios12

Multiple commands produce error - Cocoapods multiple targets & platforms


I'm building an iOS app which I want to update with the newest Siri Shortcuts, all is working fine when building on device and testing but I get errors when archiving.

This is the error I'm getting:

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'

I've got 4 of these errors, all look the same but for different Pod.

The multiple platforms is explainable because of the main project platform begin iOS 10.0 but for the Siri Shortcuts Intent and Intent UI I need to use platform iOS 12.0. Still this seems to give a problem.

This is my 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  

Solution

  • I found out that for Siri Shortcuts the Intents & IntentsUI targets don't require platform :ios, '12.0' so when I changed that to platform :ios, '10.0' it removed the duplicate frameworks targets and the archiving issue was fixed.