美文网首页
2020-08-12 Showing All Issues Mu

2020-08-12 Showing All Issues Mu

作者: 我是小胡胡分胡 | 来源:发表于2020-08-12 00:31 被阅读0次

    子Pod 用到xxx.xcassets
    主工程也用到Images.xcassets

    就一直报错!!!
    pod 版本 1.8.4
    Xcode版本 11.x

    Showing All Issues
    Multiple commands produce '/Users/xxx/Library/Developer/Xcode/DerivedData/xxx-dtmfbratpdgyklbqvnmbtbnwhaje/Build/Products/Debug-iphoneos/xxx.app/Assets.car':

    1. Target 'xxx' (project 'xxx') has compile command with input '/Users/huchu/Desktop/xxx/xxx/xxx/Images.xcassets'
    2. That command depends on command in Target 'xxx' (project 'xxx'): script phase “[CP] Copy Pods Resources”

    1、
    搜索podspec文档,需要子pod不能用这种方式,需要包装到bundle包里面

      s.resources = "xxx/Resources/*.{xcassets,plist,json,png}"
    

    即上面改为

    spec.resource_bundles = {
        'MapBox' => ['MapView/Map/Resources/*.png'],
        'MapBoxOtherResources' => ['MapView/Map/OtherResources/*.png']
      }
    

    这不是闹着玩吗, 这用的时候代码不就很麻烦了,还得指定bundle,

    2、
    还有一种方法,就是手动删除!

    image.png

    3、
    还有一种方法,说是修改workspace settings


    image.png

    这显然不合适,既然有new build system 为啥要用legacy!

    4、
    还有一种做法就是 修改project.pbxproj, 将这个objectVersion版本号强制改为 小于50

    {
        archiveVersion = 1;
        classes = {
        };
        objectVersion = 51;
        objects = {
    
    

    https://github.com/CocoaPods/CocoaPods/blob/b60b4ef4b57c908807139197434778b562ca1a89/lib/cocoapods/installer/user_project_integrator/target_integrator.rb

    
            # @return [String] Returns Minimum Xcode Object version for FileLists
            #
            MIN_FILE_LIST_OBJECT_VERSION = 50
    
    
           class << self
              # @param  [Xcodeproj::Project::Object::AbstractObject] object
              #
              # @return [Boolean] Whether input & output paths for the given object
              #         should be stored in a file list file.
              #
              def input_output_paths_use_filelist?(object)
                unless object.project.root_object.compatibility_version.nil?
                  version_match = object.project.root_object.compatibility_version.match(/Xcode ([0-9]*\.[0-9]*)/).to_a
                end
                if version_match&.at(1).nil?
                  object.project.object_version.to_i >= MIN_FILE_LIST_OBJECT_VERSION
                else
                  Pod::Version.new(version_match[1]) >= Pod::Version.new(MIN_FILE_LIST_COMPATIBILITY_VERSION)
                end
              end
    

    但这种方式后面替换脚本Pods-xxx-resources.sh 控制图片是否需要每次编译都打包不支持

    最后

    https://github.com/CocoaPods/CocoaPods/issues/8122

    找到启发:

    在Podfile下面添加这么一行配置,

     platform :ios, '9.0'
    install! 'cocoapods', :disable_input_output_paths => true
     
    
    image.png

    终于算可以了, 只要肯下功,铁棒磨成针,即使很无聊,它也是个问题的存在!
    这个succesed 不容易啊

    相关文章

      网友评论

          本文标题:2020-08-12 Showing All Issues Mu

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