创建自己的cocoaPods库
1.查询自己有没有pods账号
pod trunk me
2.注册
pod trunk register
3.创建xxx.podspec文件
Pod::Spec.new do |s|
s.name = 'XJBleSDK'
s.version = '1.0.0'
s.summary = 'A short description of XJBleSDK.'
s.homepage = 'http://gitlab.xroom.net/ios/blesdk'
s.license = 'MIT'
s.authors = {'HEJJY' => '326629321@qq.com'}
s.platform = :ios, '9.0'
s.source = {:git => 'http://gitlab.xroom.net/ios/blesdk.git', :tag => s.version}
s.source_files = 'XJBleSDK/*.{h,m}'
s.requires_arc = true
end
4.检测有没有错误和警告
pod spec lint
5.上传到cocoaPods
pod trunk push 没有警告和错误上传
pod trunk push --verbose --allow-warnings 忽略警告上传
6.pod search 搜索不到 [!] Unable to find a specification for `xxx`
7.pod lib lint
静态库报错报错** BUILD FAILED ** The following build commands failed: Ld ***/Release-iphonesimulator/App.build/Objects-normal/arm64/Binary/App normal arm64
解决方法在podspec
中添加:
s.pod_target_xcconfig = {
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
}
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
$(SRCROOT) 项目根目录下
$(PROJECT_DIR) 整个项目
ps:往项目里添加文件时,若文件不在工程目录中,而在工程父目录中,可写成 $(SRCROOT)/../XXSDK/XXX.framework。其中 /../ 就是指向父目录。
参考:https://www.jianshu.com/p/bd82cdafeb32