1 git 与github
要通过pod 集成,git和github是基础 。git 要和github 关联可以是https ssh,ssh 是主流方式,
查看本地ssh
cd ~/.ssh
ls
如果电脑已经有ssh key 会显示 id_rsa id_rsa.pub 一对公私秘钥
没有需要手动创建
ssh-keygen -t rsa -C "7543836065@qq.com"
输出
Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]
不输入文件名,使用默认文件名(推荐),那么就会生成 id_rsa 和 id_rsa.pub 两个秘钥文件。
Enter passphrase (empty for no passphrase):
# Enter same passphrase again:
也不要输入密码,没必要,要不每次使用ssh 提交代码都要输入密码
拷贝公钥到github中cat id_rsa.pub 获取公钥字符串
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCwbNBD5J4FJM5os4e0CoVab69tZAlLssyrgPy9FPpXVgpQ0HHqhrUYP4meNxmyzvjIdnAGtqab3uHJJ05ByTCToOPuPccMeKgchQv+RGTICEE7PeReHDqUkZzYQ0K5wZWrf2XoIy4IoBGv0lpm5JNjCgvaSAa36jrM4Tpul9gMk6h4g5MI1DjX1oZlLHBFz7srayg7SKUAKmeSfJV9dwbVvF9KUnqf3tx1/BPj4mIueeFJB46t/815YWdbAh/X06mf7vP3HlcaPHFL95sKUYvng3Xzx52Ig4zDEjHAWtJgkuyBYgBwWFfVJsa0vjMUkwKhIZB20hNvSGzMnv/XfsrykswPPZM/u5Hz18c5/hnZvDMVskeRs3v0rZhd2zfTMrUHD86lfqPacJ3UG+TeTEoVPdIFXVy39o5Hj1ZNP1h4XnsfqOwhYC/UzEcljiVDwAwLyB4N7rIBXioPsyzPxxuajpp2yZKuqWsy7iwK9N9nIS6xxaVPZ4oRS7SWne0NSz8= 754386065@qq.com
登录 github 设置->ssh key ->new key-> 粘贴上去 注意空格
测试ssh -T git@github.com 输出
The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?
再输入yes 输出一下提示说明就OK了
The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?
如何使用https 和ssh 使用
https
git clone https://github.com/hs300/csrp.git
ssh
git clone git@github.com:hs300/csrp.git
git 有本地仓库和远程仓库,本地仓库要和远程仓库建立联系。先在本地初始化了一个仓库或者从其他远程clone下来的,github 仓库也创建好了。
N多操作后提交代码
git add .
git commit -m 'xxx'
git tag 0.0.1 // 这一步非常重要 必须和后面pod描述文件里的内容保持一致
git push --tags
git push origin main (是mian 不是master)
git push origin master 报错
src refspec xxx does not match any / error: failed to push some refs to
改git push origin main 又报错 说你要合并。目前github 仓库啥也没有,直接强行推送
! [rejected] master -> master (fetch first)
git push origin master --force
参考 stackoverflow.com/questions/2…
代码修改完毕后提交到git
中间还遇见了
HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
配置一下就可以了
git config --global http.version HTTP/1.1
Failed to connect to github.com port 443: connection refused 把代理关了
2 Xcode 项目
3 Pod
创建(clone)模板
pod lib create PodTestLib
这个操作会在本地创建一个clone 一个模板仓库,改完后要提交到自己的仓库上
git remote add origin git@github.com:hs300/csrp.git //这里使用的就是SSH协议
按照提示输入参数。本地测试
pod lib lint #本地校验
pod spec lint #远程校验
会有提示错误,出了错google 搜索一下就有答案,改完还有警告可以忽略警告
pod trunk push XXSDK.podspec --allow-warnings
注册pod 账号
pod trunk register 9798989@qq.com 'wangermazi'会收到邮件,点一下确认连接就可以了。
推送到pod 服务器上pod trunk push XXSDK.podspec
成功后命令行窗口有提示,邮件也有推送。常规操作 pod update pod install
pod 描述文件创建完后 开始本地测试
can't get podspec validation [iOS] xcodebuild: Returned an unsuccessful exit code.
在描述文件中添加
github.com/CocoaPods/C…
s.pod_target_xcconfig = {
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
}
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
描述文件
#
# Be sure to run `pod lib lint XXSDK.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 = 'XXSDK'
s.version = '0.0.2'
s.summary = 'Boom game UI Pay 可以使用Xcode打开配置文件进行编辑,这里我是使用Xcode打开进行编辑的'
# 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 = '如果需要多个人维护一个库,每个人都应该有权限push提交spec文件;第一个push的人可以被认为是管理员,可以再添加子管理员,这样子管理员就有权限push了'
s.homepage = 'https://github.com/hs300/XXSDK'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'hs300' => '52069334+hs300@users.noreply.github.com' }
s.source = { :git => 'https://github.com/hs300/XXSDK.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '11.0'
s.vendored_frameworks = 'MySDK.framework'
s.source_files = 'XXSDK/Classes/**/*'
s.pod_target_xcconfig = {
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
}
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
# s.resource_bundles = {
# 'XXSDK' => ['XXSDK/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit' 配置依赖的系统库
# s.ios.libraries = 'sqlite'
# s.dependency 'AFNetworking', '~> 2.3'
end
pod 一个本地库,将一个小公司的库推送到cocopods 索引实际价值不高,还会拉长工作流。放本地也能达到需求 egg
pod 'ABUAdUnityAdapter', :path=>'../SDKs/ABUAdUnityAdapter_4.3.0.0/'
项目结构如图
fangkuai
----App
--------Podfile
----SDKs
--------ABUAdAdmobAdapter_9.13.0.0
------------ABUAdAdmobAdapter.framework
------------ABUAdAdmobAdapter.podspec
ABUAdAdmobAdapter.podspec 内容
Pod::Spec.new do |spec|
spec.name = 'ABUAdAdmobAdapter'
spec.version = '9.13.0.0'
spec.summary = 'ABUAdAdmobAdapter is a adapter SDK from Bytedance providing media union AD service.'
spec.homepage = 'https://www.csjplatform.com/gromore'
spec.description = <<-DESC
ABUAdAdmobAdapter is a adapter SDK from Bytedance providing media union AD service.
DESC
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.author = 'makaiwen'
spec.platform = :ios, '9.0'
spec.source = { :git => 'https://www.csjplatform.com/gromore' }
spec.requires_arc = true
# spec.user_target_xcconfig = {'OTHER_LDFLAGS' => ['-lObjC']}
spec.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
spec.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
spec.ios.deployment_target = '9.0'
valid_archs = ['arm64', 'armv7', 'x86_64', 'i386']
spec.ios.vendored_frameworks = 'ABUAdAdmobAdapter/ABUAdAdmobAdapter.framework'
spec.dependency 'Ads-Mediation-CN'
spec.dependency "BURelyFoundation"
end
podfile 中的内容
# project 'xxxx.xcodeproj'
#use_frameworks!
install! 'cocoapods', :deterministic_uuids => false
platform :ios, '10.0'
def pod_for_gm
# 1.GroMoreSDK核心库
pod 'Ads-Mediation-CN', :path=>'../SDKs/Ads-Mediation-CN_3.9.0.2/'
# 2.GroMore官方适配adapter
pod 'ABUAdUnityAdapter', :path=>'../SDKs/ABUAdUnityAdapter_4.3.0.0/'
pod 'ABUAdAdmobAdapter', :path=>'../SDKs/ABUAdAdmobAdapter_9.13.0.0/'
pod 'ABUAdBaiduAdapter', :path=>'../SDKs/ABUAdBaiduAdapter_5.101.0/'
pod 'ABUAdGdtAdapter', :path=>'../SDKs/ABUAdGdtAdapter_4.14.02.0/'
pod 'ABUAdSigmobAdapter', :path=>'../SDKs/ABUAdSigmobAdapter_4.6.0.0/'
pod 'ABUAdMintegralAdapter', :path=>'../SDKs/ABUAdMintegralAdapter_7.2.8.0.0/'
pod 'ABUAdCsjAdapter', :path=>'../SDKs/ABUAdCsjAdapter_4.9.0.6.0/'
pod 'ABUAdKlevinAdapter', :path=>'../SDKs/ABUAdKlevinAdapter_2.11.0.211.0/'
pod 'ABUVisualDebug', :path=>'../SDKs/ABUVisualDebug_3.9.0.2/'
end
def pod_for_adn
# 穿山甲 按实际情况使用正式或灰度;
pod 'Ads-CN','4.9.0.6' # CSJ 正式
# pod 'PangleAdSDK-iOS', '4.9.0.5-alpha.1', :subspecs => ['Ads-CN']
# pod 'Ads-CN-Beta', '4.9.0.4' # CSJ 灰度
# pod 'Ads-CN/Domestic', '4.6.0.7'
# pod 'Ads-CN/BUAdSDK', '4.6.0.7'
# 优量汇
# UnityAds
pod 'UnityAds', '4.3.0'
# Admob/GoogleAd
# pod 'Google-Mobile-Ads-SDK', '9.13.0'
# 百度SDK
pod 'BaiduMobAdSDK', '5.101'
# 广点通/优量汇
pod 'GDTMobSDK' ,'4.14.02'
# SigmobAd
pod 'SigmobAd-iOS', '4.6.0'
# 游可赢
# pod 'KlevinAdSDK', '2.11.0.211'
# pod 'KlevinAdSDK'
# MintegralAdSDK 使用时请务必使用cocoapod源
pod 'MintegralAdSDK', '7.2.8', :subspecs => [
'SplashAd',
'InterstitialAd',
'NewInterstitialAd',
'InterstitialVideoAd',
'RewardVideoAd',
'NativeAd',
'NativeAdvancedAd',
'BannerAd',
'BidNativeAd',
'BidNewInterstitialAd',
'BidInterstitialVideoAd',
'BidRewardVideoAd'
]
end
#快手
def pod_for_kusaiShou
pod 'KSAdSDK', '3.3.29'
end
target 'UnityFramework' do
pod_for_gm
pod_for_adn
pod_for_kusaiShou
end
#post_install do |installer|
# installer.pods_project.targets.each do |target|
# target.build_configurations.each do |config|
# config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
# end
# end
#end
本地pod 使用demo github.com/hs300/local… 不能直接打开编译,删了很多东西
参考
www.jianshu.com/p/208f5d217…
devfutao.com/archives/17…
blog.csdn.net/weixin_3413…