iOS cocoapods 建立自己的代码库

1 . 创建项目

git hub 上创建 一个项目 然后 git clone  (你项目的url )


2. cd 进入你工程目录下 创建 podspec文件

pod spec create  (你的文件名称) 

pod spec create   ED_NetWork


3.修改podspec文件 

s.name = "ED_NetWork"

  s.version      = "0.0.1"

  s.summary      = "A  test ED_NetWork"

  s.description  = <<-DESC

网路框架 基于NSURLSession 封装的网路框架,支持代理 和 block

                  DESC

  s.homepage    = "https://github.com/SevenandTen/ED_NetWork"

  s.license      = "MIT"

  s.author            = { "shiqiqi" => "[email protected]" }

  s.platform    = :ios ,"8.0"

  s.source      = { :git => "https://github.com/SevenandTen/ED_NetWork.git", :tag => "#{s.version}" }

  s.source_files  = "ED_NetWork", "ED_NetWork/*.{h,m}"

end


4. 验证

pod lib lint  ED_NetWork.podspec --allow-warnings 

执行 pod lib lint 时,报错:

ERROR | [iOS] unknown: Encountered an unknown error (Could not find a `ios` simulator (valid values: com.apple.coresimulator.simruntime.ios-10-3, com.apple.coresimulator.simruntime.ios-12-1, com.apple.coresimulator.simruntime.ios-8-1, com.apple.coresimulator.simruntime.tvos-12-1, com.apple.coresimulator.simruntime.watchos-5-1). Ensure that Xcode -> Window -> Devices has at least one `ios` simulator listed or otherwise add one. 

解决办法 升级CocoaPods 

sudo gem install cocoapods 


xcrun: error: unable to find utility "simctl", not a developer tool or in PA

解决方案就是去xcode设置里面,将Command line Tools设置一下,在Xcode>preferences>Locations里面,设置之后再运行终端即可


正常结果    ED_NetWork  passed validation. 


git add . 

git commit -s -m"first commit"

git push origin master


git tag -m"first release" "0.0.1" 

git push --tags


注册trunk


pod trunk me 


pod trunk register '邮箱' '用户名' --description='电脑描述'


pod trunk me 


pod spec lint  ED_NetWork.podspec  --allow-warnings 


pod trunk push ED_NetWork.podspec  --allow-warnings

你可能感兴趣的:(iOS cocoapods 建立自己的代码库)