CocoaPods更新第三方庫出錯的解決辦法
轉載自:
https://www.jianshu.com/p/0e3421961db4
執行完pod install之後,控制檯丟擲以下警告資訊:
[!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
[!] The `ProjectName [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
[!] The `ProjectName [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
.debug.xcconfig丟失
如果不解決此問題的話,會出現由於部分庫檔案找不到而導致的種種問題:
(1)編譯失敗,丟擲Undefined symbols for architecture i386錯誤
(2)呼叫庫中的方法,丟擲unrecognized selector sent to instance錯誤
?
解決方法如下:
1、開啟工程所在資料夾,找到.xcodeproj檔案,右鍵選擇【顯示包內容】,找到project.pbxproj檔案
2、開啟project.pbxproj檔案,查詢OTHER_LDFLAGS,把和這個相關的內容都刪除
3、重新執行pod install,此時應該就沒有上面出現的警告資訊了
4、編譯並執行
問題二:
3、
$ pod setup
Setting up CocoaPods master repo
[!] /usr/bin/git clonehttps://github.com/CocoaPods/Specs.git master
Cloning into ‘master’…
error: RPC failed; curl56 SSLRead()return error -9806
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
4、
$ pod setup
Setting up CocoaPods master repo
[!] /usr/bin/git clonehttps://github.com/CocoaPods/Specs.git master
Cloning into ‘master’…
error: RPC failed; curl18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
解決方法:上面錯誤主要是os10.11+和cocoapods1.0+版本升級的安全機制更改造成的。主要出現在pod setup過程中。且該過程等待時間非常長,所以,你可以在$sudo gem install -n /usr/local/bin cocoapods命令後直接執行$Git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master 該過程作用與 pod setup作用相同,作者親測。效果極佳!!!!
如果還不成功!!!!可以同樣的方法安裝正式版v0.39 然後在升級到v1.0版本
gem update --system
sudo geminstall -n /usr/local/bin cocoapods--pre