美文网首页
iOS组件化-搭建私人cocoaPods库

iOS组件化-搭建私人cocoaPods库

作者: 程序渣渣猿 | 来源:发表于2019-01-31 18:01 被阅读37次

    1. 关于私有cocoaPod组件化,和我们共有cocoaPods关系

    就是说我们需要两个仓库,一个仓库存放索引文件,另一个存放我们的代码库。

    2. 查看本地索引库

    2.1 操作方法 pod repo

    2.2 本地已经有三个索引库了。

    appframework-ios-specs
    - Type: git (master)
    - URL:  http://gitlab****/appframework-ios-specs.git
    - Path: /Users/wangjiaxiang/.cocoapods/repos/appframework-ios-specs
    
    master
    - Type: git (master)
    - URL:  https://github.com/CocoaPods/Specs.git
    - Path: /Users/wangjiaxiang/.cocoapods/repos/master
    
    PTSpecs
    - Type: git (master)
    - URL:  https://gitlab.com/WangLee/PTSpecs.git
    - Path: /Users/wangjiaxiang/.cocoapods/repos/PTSpecs
    

    3. 线上创建私有库

    如果想要创建私有库,建议选择可以创建私有库的托管平台。这里使用gitlab做为托管平台。

    3.1 gitlab点击创建。

    这里是创建私有库。README文件就不需要创建了。

    4. 创建本地库

    4.1 在本地合适的地方创建本地代码

    4.1.1 进入文件
    cd /Users/wangjiaxiang/Desktop/**/组件化/appframework


    4.1.2 创建文件
    pod lib create appframework-ios之后等待一会

    这里最好是连接自己的手机网络吧,用无线网的话,很大概率会失败,而且等待时间巨长无比。

    4.1.3 创建文件

    
    What platform do you want to use?? [ iOS / macOS ]  选择平台
    
    What language do you want to use?? [ Swift / ObjC ] 选择语言
    
    Would you like to include a demo application with your library? [ Yes / No ] 是否自动生成一个用来做demo测试的模板库
    
    Which testing frameworks will you use? [ Specta / Kiwi / None ] 是否集成测试框架
    
    Would you like to do view based testing? [ Yes / No ] 是否做基于View的测试
    
    What is your class prefix? --类文件前缀![屏幕快照 2019-01-31 下午4.45.06.png](https://img.haomeiwen.com/i1828668/c748bdf84d369762.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    

    创建完成后会自动打开工程,进入到工程中Classes文件夹下,将自己的私有库导入。

    4.2 导入私有库


    按照图中目录结构导入私有库。

    4.3 打开私有库

    进入到工程中 Example文件夹下,执行pod install

    4.3.1 进入 cd appframework-ios/Example/

    4.3.2 开始执行安装 pod install

    5. 编辑本地.podspec文件

    5.1 打开项目工程

    
    Pod::Spec.new do |s|
      s.name             = 'PTFrameWork'     ---1、组件名
      s.version          = '0.4.0'           ---2、组件版本号
      s.summary          = ' PTFrameWork.'   ---3、组件描述
    
    # This description is used to generate tags and improve search results.
    #   * Think: What does it do? Why did you write it? What is the focus?
    #   * Try to keep it short, snappy and to the point.
    #   * Write the description between the DESC delimiters below.
    #   * Finally, don't worry about the indent, CocoaPods strips it!
    
      s.description      = <<-DESC
    PTFrameWork.组件化                       ---4、组件详细描述,比3稍长一些
                           DESC
    
      s.homepage         = 'https://gitlab.com/WangLee/PTFrameWork'   ---5、组件存放地址
      # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
      s.license          = { :type => 'MIT', :file => 'LICENSE' }     ---6、证书
      s.author           = { 'wangjiaxiang' => '***@qq.com' }         ---7、联系
      s.source           = { :git => 'https://gitlab.com/WangLee/PTFrameWork.git', :tag => s.version.to_s }   ---8、组件存放地址
      # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
    
      s.ios.deployment_target = '8.0'       ---9、支持最低版本号
    
      s.source_files = 'PTFrameWork/Classes/**/*'   ---10、资源存放路径
      
      # s.resource_bundles = {
      #   'PTFrameWork' => ['PTFrameWork/Assets/*.png']
      # }
    
      # s.public_header_files = 'Pod/Classes/**/*.h'
      # s.frameworks = 'UIKit', 'MapKit'
      s.frameworks = 'Foundation'            ---11、依赖
      s.dependency 'YTKNetwork', '~>2.0.4'   ---12、依赖
      s.dependency 'ReactiveCocoa', '~>2.5'  ---13
      s.dependency 'YYModel'                 ---14
    end
    
    

    必须要更改的3,4,5,8需要更改。其中4是代码托管地址

    5.2 再次安装执行 pod install

    执行 4.3.1,4.3.2

    6. 打开,编译,运行。

    如果报错根据报错信息解决

    7.开始上传

    git add .
    git commit -m "初始化工程"
    git remote add origin http://gitlab.**/appframework-ios.git
    git push origin master -f
    git tag 0.4.0 (注:这里的版本号必须和podspec里写的版本号一致)
    git push --tags
    

    8.验证 specs文件

    进入到有 .podspec的文件

    pod spec lint --verbose --allow-warnings
    如果验证报错

     - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
        - NOTE  | xcodebuild:  note: Using new build system
        - NOTE  | [iOS] xcodebuild:  note: Planning build
        - NOTE  | [iOS] xcodebuild:  note: Constructing build description
        - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:29:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:36:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:54:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:285:10: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:313:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:315:10: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:343:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.m:1066:49: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.m:1066:111: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.m:1068:49: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.m:1068:111: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  YTKNetwork/YTKNetwork/YTKNetworkAgent.m:202:30: warning: 'dataTaskWithRequest:completionHandler:' is deprecated [-Wdeprecated-declarations]
        - NOTE  | xcodebuild:  AFNetworking/AFNetworking/AFURLSessionManager.h:212:166: note: 'dataTaskWithRequest:completionHandler:' has been explicitly marked deprecated here
        - WARN  | xcodebuild:  YTKNetwork/YTKNetwork/YTKNetworkAgent.m:456:26: warning: 'dataTaskWithRequest:completionHandler:' is deprecated [-Wdeprecated-declarations]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/extobjc/RACEXTScope.h:91:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.h:171:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.h:222:66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.h:195:75: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | xcodebuild:  66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | [iOS] xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.h:195:75: warning: 
        - NOTE  | xcodebuild:  warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | [iOS] xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.m:139:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | [iOS] xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.m:234:66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.m:448:75: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.m:323:22: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.m:1340:37: warning: possible misuse of comma operator here [-Wcomma]
        - NOTE  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.m:1340:4: note: cast expression to void to silence warning
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACDisposable.m:57:23: warning: 'initWithBlock:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        - NOTE  | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSThread.h:53:1: note: 'initWithBlock:' has been explicitly marked partial here
        - NOTE  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACDisposable.m:57:23: note: enclose 'initWithBlock:' in an @available check to silence this warning
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACCompoundDisposable.m:87:3: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACCommand.m:177:35: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
        - NOTE  | xcodebuild:  <scratch space>:42:27: note: expanded from here
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACCommand.m:190:6: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
        - NOTE  | xcodebuild:  <scratch space>:53:27: note: expanded from here
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACBlockTrampoline.m:32:49: warning: 'initWithBlock:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        - NOTE  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACBlockTrampoline.m:32:49: note: enclose 'initWithBlock:' in an @available check to silence this warning
        - NOTE  | xcodebuild:  warning: 
        - NOTE  | xcodebuild:  : warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/NSObject+RACKVOWrapper.m:57:59: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | [iOS] xcodebuild:  : warning: 
        - NOTE  | xcodebuild:  222:66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | [iOS] xcodebuild:  :66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | [iOS] xcodebuild:  195:75: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | [iOS] xcodebuild:  :35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | [iOS] xcodebuild:  222:66: warning: 
        - WARN  | [iOS] xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:29:7: warning: 
        - NOTE  | [iOS] xcodebuild:  :315:10: warning: 
        - NOTE  | [iOS] xcodebuild:  343:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - NOTE  | [iOS] xcodebuild:  :10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - ERROR | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/appframework-ios/appframework_ios.framework/Headers/PTBaseRequest.h:12:9: error: include of non-modular header inside framework module 'appframework_ios.PTBaseRequest': '/Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/YTKNetwork/YTKNetwork.framework/Headers/YTKRequest.h' [-Werror,-Wnon-modular-include-in-framework-module]
        - NOTE  | [iOS] xcodebuild:  9: error: include of non-modular header inside framework module 'appframework_ios.PTBaseRequest': '/Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/ReactiveCocoa.h' [-Werror,-Wnon-modular-include-in-framework-module]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/RACStream.h:171:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/RACEXTScope.h:91:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:29:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - NOTE  | [iOS] xcodebuild:  7: warning: 
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:54:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:285:10: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:313:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:315:10: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:343:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - NOTE  | [iOS] xcodebuild:  :3:9: fatal error: could not build module 'appframework_ios'
        - ERROR | [iOS] xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/appframework-ios/appframework_ios.framework/Headers/PTBaseRequest.h:15:9: error: include of non-modular header inside framework module 'appframework_ios.PTBaseRequest': '/Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/ReactiveCocoa.h' [-Werror,-Wnon-modular-include-in-framework-module]
        - WARN  | [iOS] xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/RACStream.h:222:66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | [iOS] xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/RACSignal+Operations.h:195:75: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | [iOS] xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-evxajghtqzhlggfygcxuhodnkmtq/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:36:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - NOTE  | [iOS] xcodebuild:  /var/folders/_7/k_1clm352l15snh5zvbxqm2w0000gn/T/CocoaPods-Lint-20190131-12109-1fqaeka-appframework-ios/App/main.m:3:9: fatal error: could not build module 'appframework_ios'
    
    Analyzed 1 podspec.
    
    [!] The spec did not pass validation, due to 3 errors.
    

    8.1 验证报错 执行pod spec lint --allow-warnings --use-libraries

    9.创建线上索引私有库

    步骤同3.1,但是需要选中Initialize repository with a README

    10. 创建本地索引私有库

    10.1 创建
    pod repo add PTSpecs https://gitlab.com/WangLee/PTSpecs.git
    10.2查看
    pod repo

    appframework-ios-specs
    - Type: git (master)
    - URL:  http://gitlab.**/appframework-ios-specs.git
    - Path: /Users/wangjiaxiang/.cocoapods/repos/appframework-ios-specs
    
    master
    - Type: git (master)
    - URL:  https://github.com/CocoaPods/Specs.git
    - Path: /Users/wangjiaxiang/.cocoapods/repos/master
    
    PTSpecs
    - Type: git (master)
    - URL:  https://gitlab.com/WangLee/PTSpecs.git
    - Path: /Users/wangjiaxiang/.cocoapods/repos/PTSpecs
    
    3 repos
    

    11. 上传本地. podspec文件到线上私有索引库

    11.1上传

    pod repo push PTSpecs appframework-ios.podspec --allow-warnings
    

    其中 PTSpecs,就是我们本地创建的索引文件名称,appframework-ios.podspec就是我们本地创建的Demo中的同名的文件
    结果可能一样报错

     - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
        - NOTE  | xcodebuild:  note: Using new build system
        - NOTE  | [iOS] xcodebuild:  note: Planning build
        - NOTE  | [iOS] xcodebuild:  note: Constructing build description
        - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file. (in target 'App')
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:29:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:36:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:54:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:285:10: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:313:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:315:10: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.h:343:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.m:1066:49: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.m:1066:111: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.m:1068:49: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  YYModel/YYModel/NSObject+YYModel.m:1068:111: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  YTKNetwork/YTKNetwork/YTKNetworkAgent.m:202:30: warning: 'dataTaskWithRequest:completionHandler:' is deprecated [-Wdeprecated-declarations]
        - NOTE  | xcodebuild:  AFNetworking/AFNetworking/AFURLSessionManager.h:212:166: note: 'dataTaskWithRequest:completionHandler:' has been explicitly marked deprecated here
        - WARN  | xcodebuild:  YTKNetwork/YTKNetwork/YTKNetworkAgent.m:456:26: warning: 'dataTaskWithRequest:completionHandler:' is deprecated [-Wdeprecated-declarations]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/extobjc/RACEXTScope.h:91:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.h:171:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.h:222:66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.h:195:75: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | xcodebuild:  warning: 
        - NOTE  | xcodebuild:  : warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | xcodebuild:  warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | xcodebuild:  66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.m:139:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.m:234:66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.m:448:75: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.m:323:22: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.m:1340:37: warning: possible misuse of comma operator here [-Wcomma]
        - NOTE  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.m:1340:4: note: cast expression to void to silence warning
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACDisposable.m:57:23: warning: 'initWithBlock:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        - NOTE  | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSThread.h:53:1: note: 'initWithBlock:' has been explicitly marked partial here
        - NOTE  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACDisposable.m:57:23: note: enclose 'initWithBlock:' in an @available check to silence this warning
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACCompoundDisposable.m:87:3: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACCommand.m:177:35: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
        - NOTE  | xcodebuild:  <scratch space>:42:27: note: expanded from here
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACCommand.m:190:6: warning: unknown warning group '-Wreceiver-is-weak', ignored [-Wunknown-warning-option]
        - NOTE  | xcodebuild:  <scratch space>:53:27: note: expanded from here
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACBlockTrampoline.m:32:49: warning: 'initWithBlock:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        - NOTE  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACBlockTrampoline.m:32:49: note: enclose 'initWithBlock:' in an @available check to silence this warning
        - NOTE  | [iOS] xcodebuild:  :171:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | xcodebuild:  :66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  ReactiveCocoa/ReactiveCocoa/NSObject+RACKVOWrapper.m:57:59: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | xcodebuild:  222:66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | [iOS] xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACSignal+Operations.h:195:75: warning: 
        - WARN  | [iOS] xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.h:222:66: warning: 
        - WARN  | [iOS] xcodebuild:  ReactiveCocoa/ReactiveCocoa/RACStream.h:171:35: warning: 
        - ERROR | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/appframework-ios/appframework_ios.framework/Headers/PTBaseRequest.h:12:9: error: include of non-modular header inside framework module 'appframework_ios.PTBaseRequest': '/Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/YTKNetwork/YTKNetwork.framework/Headers/YTKRequest.h' [-Werror,-Wnon-modular-include-in-framework-module]
        - NOTE  | [iOS] xcodebuild:  error: include of non-modular header inside framework module 'appframework_ios.PTBaseRequest': '/Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/ReactiveCocoa.h' [-Werror,-Wnon-modular-include-in-framework-module]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/RACStream.h:222:66: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | [iOS] xcodebuild:  :195:75: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/RACEXTScope.h:91:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:29:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:36:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:54:7: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:285:10: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:313:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:315:10: warning: '@interface' command should not be used in a comment attached to a non-interface declaration [-Wdocumentation]
        - WARN  | xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/YYModel/YYModel.framework/Headers/NSObject+YYModel.h:343:10: warning: '@class' command should not be used in a comment attached to a non-class declaration [-Wdocumentation]
        - NOTE  | [iOS] xcodebuild:  9: fatal error: could not build module 'appframework_ios'
        - ERROR | [iOS] xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/appframework-ios/appframework_ios.framework/Headers/PTBaseRequest.h:15:9: error: include of non-modular header inside framework module 'appframework_ios.PTBaseRequest': '/Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/ReactiveCocoa.h' [-Werror,-Wnon-modular-include-in-framework-module]
        - WARN  | [iOS] xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/RACStream.h:171:35: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - WARN  | [iOS] xcodebuild:  /Users/wangjiaxiang/Library/Developer/Xcode/DerivedData/App-cpeipgufzruyfbcperhbjtjmwuxk/Build/Products/Release-iphonesimulator/ReactiveCocoa/ReactiveCocoa.framework/Headers/RACSignal+Operations.h:195:75: warning: this block declaration is not a prototype [-Wstrict-prototypes]
        - NOTE  | [iOS] xcodebuild:  /var/folders/_7/k_1clm352l15snh5zvbxqm2w0000gn/T/CocoaPods-Lint-20190131-13334-1iiwwtk-appframework-ios/App/main.m:3:9: fatal error: could not build module 'appframework_ios'
    
    [!] The `appframework-ios.podspec` specification does not validate.
    

    11.2如果报错

    pod repo push PTSpecs appframework-ios.podspec --allow-warnings --use-libraries
    

    12 使用

        
    source 'https://gitlab.com/WangLee/PTSpecs.git'
    source 'https://github.com/CocoaPods/Specs.git'
    
    platform :ios, '8.0'
    
    target 'Demo’ do
        pod 'PTFrameWork'
    end
    

    13 补充

    13.1 如果组件化引用私有库
    1. ***.podspec文件中添加引用(步骤5
    s.dependency '私有库'
    
    1. Podfile文件中添加私有库地址
    source 'http://gitlab.**.com.cn:10080/***.git'
    source 'https://github.com/CocoaPods/Specs.git'
    
    1. 重复执行 pod install(步骤5.2
    13.2 私有控件使用

    将所有依赖的库地址都添加到Podfile文件中

    source 'http://gitlab.**.com.cn:10080/***.git'
    source 'https://github.com/CocoaPods/Specs.git'
    source 'http://gitlab.**.com.cn:10080/***.git'
    platform :ios, '8.0'
    
    target 'PTB’ do
        pod '私有库'
    end
    
    13.3 依赖私有组件验证执行不通过问题

    问题可能会处在步骤8

    添加私有依赖之后,验证执行需要带上私有库地址,有多少私有库,地址全部都加上

    pod spec lint --allow-warnings --use-libraries --sources='http://gitlab.**.com.cn:10080/**.git,https://github.com/CocoaPods/Specs.git'
    

    相关文章

      网友评论

          本文标题:iOS组件化-搭建私人cocoaPods库

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