pod建立私有库

本地验证
pod lib lint --allow-warnings

远端验证:
pod spec lint --use-libraries --allow-warnings

本地验证查看错误内容
pod lib lint --allow-warnings --verbose | tee outPut17.txt
pod lib lint --verbose | tee outPut10.txt

//提交代码
Git add .
Git commit -m “xxxxfirst commit”
git push

//打tag 0.1.0要和podspec 中的version一致
git tag 0.1.0
git push —tags

提交

  1. 提交到podspect仓库(公网,别的项目可以在podfile里 pod 'SVShootComponent.podspec', '~> 0.1.0’ 这样引用)
    pod repo push PrivatePodspectLab SVShootComponent.podspec --verbose --allow-warnings

  2. 不提交到公网,直接用Git地址引入,别的项目可以在podfile里 添加如下语句
    pod 'SVShootComponent', :git => '[email protected]:Component/SVShootComponent.git', :tag => '0.1.2'

  s.source_files = 'SVShootComponent/Classes/**/*'     //代码文件位置
  s.exclude_files = 'SVShootComponent/Classes/Framework'  //不包含代码的位置
   s.vendored_frameworks = 'SVShootComponent/Classes/Framework/*.framework'  //framework位置

3 错误分析

报错ld: building for iOS Simulator, but linking in dylib built for iOS, file '/User xxx, 添加下面2行代码解决

    s.pod_target_xcconfig = {
      'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64',
    }
s.user_target_xcconfig = {
      'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
    }

报错ld: symbol(s) not found for architecture i386, 排除验证i386即可,排除加上i386

s.pod_target_xcconfig = {
      'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 i386',
    }
    s.user_target_xcconfig = {
      'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 i386'
    }

访问本工程外部的framework,添加FRAMEWORK_SEARCH_PATHS即可,添加他后可以不写s.vendored_frameworks。外部工程会按FRAMEWORK_SEARCH_PATHS 的路径找framwork进行连接。pod文件SVShootComponent里也不会生成一份xxx.framework
vendored_frameworks 是在当前私有库工程路径下找framework,framwork位置不能超出当前工程,外部工程pod install 后 会在外部工程的pod文件SVShootComponent里生成一份xxx.framework

s.pod_target_xcconfig = {
      'FRAMEWORK_SEARCH_PATHS' => '../../Modules/TvSdk/Framework ../../Libs/PlayerFrame'
    }
 不用写 (s.vendored_frameworks = 'SVShootComponent/Classes/Framework/*.framework')

你可能感兴趣的:(pod建立私有库)