Board logo

标题: CocoaPods私有库制作(小白教程) -2 [打印本页]

作者: look_w    时间: 2019-4-12 13:54     标题: CocoaPods私有库制作(小白教程) -2

四、创建Pod代码库

有了仓库,我们就可以添加代码库啦。
4.1 使用pod创建库:

pod lib create EHIHiCarBluetooth



过程中终端会向我们提出一系列问题,大家自行选择即可。
4.2 添加文件,写好Demo

如图,添加文件:



工程目录如下:



在Example中写好Demo,保证编译运行ok。
4.3 编辑*.podspec

    务必保证填写的每一项都要是正确的,比如主页和链接都要能够访问。

编辑EHIHiCarBluetooth.podspec文件如下:

    #
    # Be sure to run `pod lib lint EHIHiCarBluetooth.podspec' to ensure this is a
    # valid spec before submitting.
    #
    # Any lines starting with a # are optional, but their use is encouraged
    # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
    #
     
    Pod::Spec.new do |s|
        s.name             = 'EHIHiCarBluetooth'
        s.version          = '0.1.0'
        s.summary          = '一句话描述'
        
        # 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
        TODO: Add long description of the pod here.
        DESC
        
        s.homepage         = 'http://私有库地址/EHILibraryiOS/EHIHiCarBluetooth'
        # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
        s.license          = { :type => 'MIT', :file => 'LICENSE' }
        s.author           = { '用户名' => '邮箱地址' }
        s.source           = { :git => 'http://私有库地址/EHILibraryiOS/EHIHiCarBluetooth.git', :tag => s.version.to_s }
        # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
        
        s.ios.deployment_target = '8.0'
        
        s.source_files = 'EHIHiCarBluetooth/Classes/*'
        
        # s.resource_bundles = {
        #   'EHIHiCarBluetooth' => ['EHIHiCarBluetooth/Assets/*.png']
        # }
        
        # s.public_header_files = 'Pod/Classes/**/*.h'
        # s.frameworks = 'UIKit', 'MapKit'
        
        s.dependency 'YYKit'
        s.dependency 'BabyBluetooth', '~> 0.7.0'
    end




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0