美文网首页iOS开发资料收集区cocoapod
私有库不支持模拟器,pod lib lint / repo pu

私有库不支持模拟器,pod lib lint / repo pu

作者: little_ma | 来源:发表于2019-05-06 15:45 被阅读0次

最近封装公司的私有库,由于要对接Engine,Engine提供的库很多不支持模拟器编译,那么私有库发版就无法通过正常的验证。最好的解决方案肯定是,让上游所有的SDK是支持模拟器的,基本上是可以做的,就是时间问题。不过很烦的是,部门间的额沟通往往没这么快,所以需要我们研究一下避开验证,直接发布的方式来解决当前问题。
那么如何来解决呢?
具体步骤:
1)、.podspec文件中添加s.pod_target_xcconfig = { 'skip_validation' => true },主要是添加跳过验证标识符
2)、找到检测源码的文件validator.rb,修改它跳过验证。
如何找到呢?
在终端中键入gem which cocoapods
/Users/ios_team08/.rvm/gems/ruby-2.3.3@global/gems/cocoapods-1.6.1/lib/cocoapods.rb
顺藤摸瓜,在对应的路径下找到validator.rb:
/Users/ios_team08/.rvm/rubies/ruby-2.3.3/lib/ruby/gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb
打开此文件找到对应的ios的验证,如下图位置:

10A76751-62B3-4A2A-AB74-6C532640BCF1.png

替换代码

command += %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator)
command += Fourflusher::SimControl.new.destination(:oldest, 'iOS', deployment_target)
xcconfig = consumer.pod_target_xcconfig
if xcconfig
     archs = xcconfig['VALID_ARCHS']
     if archs && (archs.include? 'armv7') && !(archs.include? 'i386') && (archs.include? 'x86_64')
          # Prevent Xcodebuild from testing the non-existent i386 simulator if armv7 is specified without i386
          command += %w(ARCHS=x86_64)
     end
 end

为以下代码:

xcconfig = consumer.pod_target_xcconfig
if xcconfig && xcconfig['skip_validation']
      command += %w(--help)
      print("===========================warning :: SKIP VALIDATION============================'\n'")
      else
      command += %w(CODE_SIGN_IDENTITY=- -sdk iphonesimulator)
      command += Fourflusher::SimControl.new.destination(:oldest, 'iOS', deployment_target)
      xcconfig = consumer.pod_target_xcconfig
      if xcconfig
          archs = xcconfig['VALID_ARCHS']
          if archs && (archs.include? 'armv7') && !(archs.include? 'i386') && (archs.include? 'x86_64')
              # Prevent Xcodebuild from testing the non-existent i386 simulator if armv7 is specified without i386
              command += %w(ARCHS=x86_64)
          end
      end
end

然后再次运行运行验证或者push都没问题了,不过此方案为避开验证,最好能不使用还是不要使用。

那么有没有不修改电脑配置和.podspec配置,绕过验证直接发版本的方式呢?

当然也是有的。
如何做呢?

私有仓库发布版本的过程实际也是向你的私有Specs仓库commit的过程,如果你的仓库提交后也可以直接在你的Specs仓库上传对应的版本.podspec
如下图所示,直接创建对应文件夹,上传需要发布的.podspec即可


image.png

参考文档

相关文章

网友评论

    本文标题:私有库不支持模拟器,pod lib lint / repo pu

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