Xcode10 Archive Error - Multiple command ... 'xxx/Info.plist' 解决方案

报错信息

:-1: Multiple commands produce '/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-cqedfsiaqyswfpdkffoiytinrkcj/Build/Intermediates.noindex/ArchiveIntermediates/XXX/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Info.plist':
1) Target 'XXX' (project 'Pods') has copy command from '/Users/XXX/Documents/SourceCode//XXX/Pods/XXX/XXX/Info.plist' to '/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-cqedfsiaqyswfpdkffoiytinrkcj/Build/Intermediates.noindex/ArchiveIntermediates/XXX/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Info.plist'
2) Target 'XXX' (project 'Pods') has copy command from '/Users/XXX/Documents/SourceCode//XXX/Pods/XXX/XXX/Info.plist' to '/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-cqedfsiaqyswfpdkffoiytinrkcj/Build/Intermediates.noindex/ArchiveIntermediates/XXX/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Info.plist'
3) Target 'XXX' (project 'Pods') has copy command from '/Users/XXX/Documents/SourceCode/XXX/Pods/XXX/XXX/Info.plist' to '/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-cqedfsiaqyswfpdkffoiytinrkcj/Build/Intermediates.noindex/ArchiveIntermediates/XXX/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Info.plist'
4) Target 'XXX' (project 'Pods') has copy command from '/Users/XXX/Documents/SourceCode/XXX/Pods/XXX/XXX/Info.plist' to '/Users/XXX/Library/Developer/Xcode/DerivedData/XXX-cqedfsiaqyswfpdkffoiytinrkcj/Build/Intermediates.noindex/ArchiveIntermediates/XXX/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Info.plist'

原因

Xcode10使用了新的task的build方式,之前在做私有库的时候没有很严格,将私有库的Info.plist文件也放在了Pod-Spec文件中引入到工程了,所以新的打包方式将这些Info.plist和主工程的都copy到相同的地方发生了报错。

解决方案

原因知道了那么解决方案就很清楚--将这些Info.plist从工程中删除掉:

  1. 修改私有库的spec文件,然后升级每一个私有库。这是最正确的但是有很多时候项目私有库很多,依赖很复杂,升级一次成本很高。
  2. 既然使用了Pod那就在Pod脚本上想想办法,很显然可有在Podfile的Hook方法,post_install里面讲pod库的Info.plist引用删除掉,代码如下:
### HOOK POST
post_install do |installer|
    installer.pods_project.native_targets.each do |natviTarget|
        natviTarget.build_phases.each do |buildPhase|
            info_plist_ref = buildPhase.files.find { |f| f.file_ref.to_s == "Info.plist" }
            if info_plist_ref
               buildPhase.remove_reference(info_plist_ref)
            end
        end
    end
end

你可能感兴趣的:(Xcode10 Archive Error - Multiple command ... 'xxx/Info.plist' 解决方案)