美文网首页
cocoapods创建管理私有库(二)

cocoapods创建管理私有库(二)

作者: 苒妈 | 来源:发表于2016-12-05 14:53 被阅读98次

    项目中引用chart,Flurry等第三方库。还有公司内容整理的公共库内容。公司产品越来越多,功能模块重用的也越来越多。打算全部使用cocoapods来统一管理。但是公司的公共库不方便公开,所以建立�cocoa Touch Static Library。

    (1)手动建立Cocoa Touch Static Library.
    (2)新建Podfiles.

    target 'PDUtils'  do
    
    pod 'GTMNSStringHTMLAdditions'
    pod 'AutoCoding'
    
    use_frameworks!
    pod 'KissXML'
    pod 'KKWeChatSDK'
    pod 'WeiboSDK' , '3.1.3'
    
    pod 'Flurry-iOS-SDK/FlurrySDK',       '7.8.2'
    
    end
    

    (3)新建PDUtils.podspec。

    Pod::Spec.new do |s|
      s.name         = "PDUtils"
      s.version      = "0.0.1"
      s.summary      = "description of PDUtils."
      s.description  = <<-DESC
            description of FYTUtils
           DESC
    
      s.homepage     = "http://www.baidu.com"
      s.license = { :type => 'MIT', :text => <<-LICENSE
             Copyright 2016
              LICENSE
          }
    
        s.author             = { "test" => "test@test.cn" }
        s.platform     = :ios, "8.0"
    
        s.source       = { :svn => "../PDUtils" }
        s.source_files  = "PDUtils", "PDUtils/**/*.{h,m}", "PDUtils/PDUtils.h"
        s.public_header_files = "PDUtils/PDUtils.h", "PDUtils/**/*.{h}"
    
        s.frameworks = "UIKit", "Foundation", "CoreLocation", "GLKit",       "UserNotifications","CoreTelephony"
        s.library   = "xml2"
    
        s.dependency "KissXML"
        s.dependency "AutoCoding"
        s.dependency "GTMNSStringHTMLAdditions"
        s.dependency "Flurry-iOS-SDK"
    
      end
    

    至此,私有库PDUtils创建完成。


    PDUtils中包括下载、定位等内容。还有一些登录注册界面等也想组成一个库,方便各工程使用,于是又建Cocoa Touch Static Library。
    (4)新建Cocoa Touch Static Library:PDModules
    (5)新建Podfiles.
    target 'B' do

    pod 'SVProgressHUD'
    pod 'PDUtils', :path => '../PDUtils'
    
      end
    

    (6)在PDModules中新建UserLogionController.h和.m
    #import <PDUtils/PDUtils.h>
    (7)build成功。
    (8)新建PDModules.podspec

      Pod::Spec.new do |s|
    
        s.name         = "PDModules"
        s.version      = "0.0.1"
        s.summary      = "Controller and View"
        s.description  = <<-DESC
                  Controller and View, contains :
                  UserLogin|register|pwd
                DESC
    
         s.homepage     = "http://www.baidu.com"
         s.license = { :type => 'MIT', :text => <<-LICENSE
                    Copyright 2016
                    LICENSE
                }
    
          s.author             = { "test" => "test@test.com" }
        s.platform     = :ios, "8.0"
        s.source       = { :svn => "../B" }
        s.source_files  = "B", "B/*.{h}", "B/**/*.{h,m}"
        s.resources     = "B/**/*.{xib}"
        s.public_header_files = "B/*.h", "B/**/*.{h}"
    
        s.frameworks = "UIKit", "Foundation","CoreLocation", "GLKit", "UserNotifications", "CoreTelephony"
    
        s.library   = "xml2"
    
        s.dependency "KissXML"
        s.dependency "AutoCoding"
        s.dependency "GTMNSStringHTMLAdditions"
        s.dependency "Flurry-iOS-SDK"
        s.dependency "SVProgressHUD"
        s.dependency 'PDUtils'
    

    <b>(9)pod spec lint
    错误。“PDUtils/PDUtils.h”file not found.</b>

    (10)但是pod ‘B ’ 到测试工程C中,编译运行均正常。

    在C的Podfiles文件中
    pod 'PDUtils', :path = "../PDUtils"
    pod 'B', :path = "../B"


    <b>第(9)中的错误到底应该怎么处理?

    感觉像是在B.podspec中少了关于PDUtils的内容,到底少了什么

    看有人说是pod lib lint --quick通过。但pod spec lint 始终不能成功。
    有知道的烦请回复下,不胜感激。
    </b>

    屏幕快照 2016-12-05 下午3.10.07.png

    特别感谢http://www.jianshu.com/p/fc5d87574e77

    相关文章

      网友评论

          本文标题:cocoapods创建管理私有库(二)

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