美文网首页iOS程序猿iOS学习开发
Xcode10 Archive Error - Multiple

Xcode10 Archive Error - Multiple

作者: 马修王 | 来源:发表于2019-01-09 11:31 被阅读4次

报错信息

:-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|
            infoPlistRef = buildPhase.files.find { |f| f.file_ref.to_s == "Info.plist" }
            if infoPlistRef
               buildPhase.remove_reference(infoPlistRef)
            end
        end
    end
end

相关文章

网友评论

    本文标题:Xcode10 Archive Error - Multiple

    本文链接:https://www.haomeiwen.com/subject/tepwrqtx.html