1. 引入第三方靜態(tài)庫(kù) (Framework)
比如 frameworks 放在 WTBAuth/Vender 下面的某個(gè)文件夾里面.
在 podspec 中這么寫(xiě):
s.vendored_frameworks = 'WTBAuth/Vender/*/*.framework'
2. 依賴(lài)系統(tǒng)庫(kù)
例如 libstd++.tbd
省略 lib 和 .tbd 后綴, 可以這么寫(xiě):
s.libraries = 'stdc++'
3. 依賴(lài)自己的私有庫(kù)
如果個(gè)人私有庫(kù)沒(méi)有在 Cocoapods 發(fā)布, 直接 s.dependency 'DKNetwork', 在 pod install 時(shí)候肯定會(huì)報(bào)錯(cuò).
解決辦法:
在 Podfile 里面也加入私有的 pod 相關(guān)配置:
pod 'DKNetwork', :git => 'https://host.com/username/DKNetwork.git'
并且同時(shí)在 podspec 中添加依賴(lài):
s.dependency 'DKNetwork'
即可解決.
[!] The '' target has transitive dependencies that include static binaries: ......
4. 依賴(lài)中包含靜態(tài)庫(kù)
比如需要用友盟分享(包含幾個(gè)framework), 并且 Podfile 里面有 use_framework!, 會(huì)報(bào)錯(cuò):
target has transitive dependencies that include static binaries
簡(jiǎn)單點(diǎn)的解決辦法: 自己封裝一下, 搞成一個(gè) framework, 使用 1 中的辦法引入進(jìn)去.
5. 工程的配置
配置 Other Linker Flags :
s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => ['-ObjC' , '-lstdc++'] , 'ENABLE_BITCODE' => 'NO'}
配置 bitcode :
// 配置當(dāng)前庫(kù)的 bitcode
s.pod_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }
// 配置宿主工程的 bitcode
s.user_target_xcconfig = { 'ENABLE_BITCODE' => 'NO' }