問題1
pod的時候可能會遇到libwebp v0.6.0 超時問題,
解決方案:
直接進(jìn)入到/Users/(你本地的名字)/.cocoapods/repos/master/Specs/1/9/2/libwebp ,選擇0.6.0文件夾把里面的libwebp.podspec.json打開,修改里面的git地址為 https://github.com/webmproject/libwebp.git 就可以了。
問題2
[!] Unable to find a specification for FMDB depended upon by MCLib
原因:Podfile 在私有庫后面配置了 source,沒有考慮到私有庫 A 依賴的私有庫 B,而私有庫 B 依賴 FMDB, 在設(shè)置的 source 中找不到 FMDB。
解決1:
source 'https://github.com/CocoaPods/Specs.git'
解決2:
pod 'A' , '0.0.1' , :source => 'git@10.2.250.21:MCLib/specRepo_iOS.git'
問題3
None of your spec sources contain a spec satisfying the dependency: MySpecialIndexRepository (~> 7.0.0).
解決方法:
pod install --repo-update
問題4
[!] CocoaPods could not find compatible versions for pod "TestPodSourceLayered":
In Podfile:
xxx
Specs satisfying the TestPodSourceLayered dependency were found, but they required a higher minimum deployment target.
解決方法:
原因是你要pod install的profile 文件 支持的部署最低版本 小于它依賴xxx支持的最低的部署版本,將當(dāng)前要pod install 工程的 platform :ios, 'n',n大于等于xxx庫的最低部署版本即可
問題5
[!] The repo xxx at ../../../../../.cocoapods/repos/TALComponentTest-Spec is not clean
解決方法:
step 1: 移除本地私有索引庫:pod repo remove xxx
step 2 : 添加本地私有索引庫:pod repo add xxx https://gitee.com/?.git
3》添加本地podspec文件到遠(yuǎn)程私有索引庫即可:pod repo push xxx (要推送的私有庫).podspec --allow-warnings
私有庫依賴公開庫例如SDWebImage或者其他自己公司的私有庫 ,導(dǎo)致pod lib lint 或者 pod spec lint一直失敗
- ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for
TestPodSourceLayereddepended upon byTestModule
解決方法:
原因是如果其他其他的庫,執(zhí)行校驗(yàn),如果不指定其他庫的spec地址(就是其他庫podspec對應(yīng)spec repo 索引庫地址),它會去cocoapods master去去找,所以報錯
遠(yuǎn)程驗(yàn)證:
pod spec lint --sources='https://github.com/github名字/xxx.git,https://github.com/CocoaPods/Specs.git' --verbose
本地驗(yàn)證:
pod spec lint --sources='https://github.com/github名字/xxx.git,https://github.com/CocoaPods/Specs.git' --verbose
推送的話:
pod repo push 本地私有庫名字 xxx.podspec --sources='https://github.com/github名字/xxx.git,https://github.com/CocoaPods/Specs.git' --verbose
問題6
[!] Unable to find a specification for xxx depended upon by TestModuleB
解決方案:
沒有在podfile里添加source源導(dǎo)致 ,加入xxx對應(yīng)的spec repo 地址即可,注意是spec索引庫的地址
問題7
Specs satisfying the xxx (from../) dependency were found, but they required a higher minimum deployment target.
解決方案:
原因你依賴的xxx庫的部署最低版本大于你的podfile中的最低部署版本,一種你修改podfile的部署版本大于等于xxx的最低部署庫版本;如果你有xxx庫的修改權(quán)限,還有一種方式就是你修改xxx的最低部署版本,小于等于你的podfile的最低部署版本 ;
問題 8
pod spec lint- ERROR | [iOS] [xxx] file patterns: The source_files pattern did not match any file.
解決方案:
是xxx對應(yīng)的路徑不對,需要是podspec同級為準(zhǔn),依次類推即可
問題9
- ERROR | [iOS] file patterns: The
vendored_librariespattern did not match any file.
解決方案:
第一步:檢測看看是不是自己的路徑錯誤,所有的路徑都要基于Pod名字那一層級也就是podspec文件同級開始,依次類推;
第二步:如果第一步確定不是路徑問題,看看提示的文件是不是被.gitignore文件設(shè)置為忽略文件啦,我的引入了.a文件,pod spec文件遠(yuǎn)程校驗(yàn)一直不通過,但是pod lib 一直沒問題,我就猜測遠(yuǎn)程pod repo 沒有該文件導(dǎo)致,一看遠(yuǎn)程倉庫確實(shí)沒有,沒有的話肯定是被忽略啦,這是我看了工程忽略沒有忽略,看了全局確實(shí)忽略了所有的 *.a文件,被坑一下
問題10
[!] Unable to find a pod with name, author, summary, or description matching xxx
解決方案:
一般情況下,執(zhí)行完pod repo push ,需要等待1小時才可以搜索到,但是我們都是急性子,解決方法如下
第一步執(zhí)行: rm -rf ~/Library/Caches/Cocoapods
第二步執(zhí)行:重新執(zhí)行 pod search xxx 或者 直接 pod install --repo-updat 即可
問題11
pod lab lint 報錯 - NOTE | [iOS] xcodebuild: warning: The iOS Simulator deployment target 'IPHONEOS_DE
解決方法:驗(yàn)證后面加上 --skip-import-validation
其他問題整合
[其他收集cocoapods 常見錯誤對應(yīng)的解決方法 ] (http://www.mengyueping.com/2018/08/16/iOS_CocoaPods_03/
)
問題12
問題描述:
//問題1:警告第三方庫或者文件和xcode 的 build setting設(shè)置的framework搜索路徑重復(fù)啦
[!] TheTALStreamDemo [Debug]target overrides theFRAMEWORK_SEARCH_PATHS>build setting defined in `Pods/Target Support Files/Pods-TALStreamDemo/Pods->TALStreamDemo.debug.xcconfig'. This can lead to problems with the CocoaPods installation
解決步驟:
step1: 打開項(xiàng)目 Target - Build Settings ,搜索 Other Linker Flags ,在這個設(shè)置上加入 $(inherited) 。
step2: 打開項(xiàng)目 Target - Build Settings,在FRAMEWORK_SEARCH_PATHS 這個塊里添加一個元素為$(inherited) 。
問題13
問題描述:集成cocoapods的時候報錯:'xxx' file not found with include; use "quotes" instead
解決步驟:
引用路徑的問題,更改引用路徑。例如:#import <JSONModel.h>,改成#import <JSONModel/JSONModel.h> 就可以了
問題14
問題描述:ld: framework not found TALMarsXlog_YHZZ
解決步驟:
原因是你項(xiàng)目導(dǎo)入的第三方framework或者私有庫里的framework不支持模擬器導(dǎo)致導(dǎo)致,第一種xcode 連接真機(jī)編譯;如果真的需要支持編譯模擬器,如果自己有權(quán)限有修改依賴的framework進(jìn)行重新編譯模擬器架構(gòu)的framework即可,如果沒有操作權(quán)限只能換其他的庫啦。
問題15
問題描述:[!] CocoaPods could not find compatible versions for pod "xxx":
In snapshot (Podfile.lock):
刪除工程里 .xworkspace .podlock Pods文件 重新執(zhí)行 pod install --repo-update 即可
問題16
問題描述: Cloning spec repo 'cocoapods' from 'https://github.com/CocoaPods/Specs.git'
一直等待中或者超時
方式1:http://ping.chinaz.com/github.com 進(jìn)入這個網(wǎng)址 輸入github.com 然后進(jìn)行ping檢測,獲取ttl延遲最小的ip,在mac上 的host文件進(jìn)行配置,ip + guithub.com
方式2: 在cocoapods/repos/ 目錄下 創(chuàng)建 master文件 ,進(jìn)入master目錄,
然后執(zhí)行 git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git . ;
然后在進(jìn)入自己項(xiàng)目中執(zhí)行pod install 即可
問題17
問題:pod庫包含xcframework的庫,執(zhí)行本地lint一直失敗,導(dǎo)致沒有辦法發(fā)布
修復(fù)方式:
升級cocoapods到1.10.0(包含)以上即可
問題8
問題:pod install報錯LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
修復(fù)方式1:
git config --global http.postBuffer 4194304000
修復(fù)方式2:
step1: 確定gem 版本sudo gem update —system
step2: 確定pod : pod update (更新項(xiàng)目podfile)
step3: 重新pod : pod repo update
step4: 安裝: pod setup
step5: 再次install: pod install
問題9
私有庫依賴的其他三方library或者framework,不支持i386,導(dǎo)致 pod lib lint一直過不了,報 ld: symbol(s) not found for architecture i386
具體報錯:
** BUILD FAILED **
The following build commands failed:
Ld /Users/xxx/Library/Developer/Xcode/DerivedData/App-eirdvplvkjwfajgnpucugqsajotp/Build/Intermediates.noindex/App.build/Release-iphonesimulator/App.build/Objects-normal/i386/Binary/App normal i386
修復(fù)方式:
在podspec文件加入以下內(nèi)容
s.pod_target_xcconfig = { 'VALID_ARCHS' => 'x86_64 armv7 arm64' }
問題10
執(zhí)行 pod update 時報錯
具體報錯:
CDN: trunk URL couldn't be downloaded:
修復(fù)方式:
先執(zhí)行
pod repo remove trunk
再執(zhí)行
pod update