網上下載了一個demo,希望從中可以學到更多。找了一個朋友幫我把demo調好了,他那邊已經在模擬器上運行了,給我之後我還是不能運行,有錯誤提示,建議執行pod install。這個是IOS的xcode第一次用的時候是需要的步驟。當然要完成這一步也要看運氣,好的就快了。我就遇到了各種問題,最終還是完成了。
1.首先對於pod的命令你想執行,需要安裝CocoaPods:打開終端,如果你沒有安裝你執行pod setup,pod install,會提示不能用這個命令
OS X 10.11以前,在終端輸入以下命令:
sudo gem install cocoapods
OS X 10.11以後,在終端輸入以下命令:
sudo gem install -n /usr/local/bin cocoapods
2.下面你執行pod install,一般情況下都不能成功,下載速度慢,文件大都會失敗,還會提示你執行pod setup:
需要一些瞭解可以看一下下面鏈接,感謝這位兄弟
鏈接:https://www.jianshu.com/p/43a268ba8f47
來源:簡書
Cloning into 'master'...
remote: Counting objects: 2002848, done.
remote: Compressing objects: 100% (445/445), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
參考這個鏈接:https://blog.csdn.net/drift_axe/article/details/54924359:
git config –global http.postBuffer 524288000
這樣的問題還是會出現。
cd ~/.cocoapods/repos/
你會看到有個master
有問題的,我們移除master:
pod repo remove master
pod repo add master https://gitcafe.com/akuandev/Specs.git //這裏的 Specs已經不是github的那個了,那個太慢
出現這個
[!] To setup the master specs repo, please run `pod setup`.
然後
git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
然後
pod repo update
然後
pod repo
出現下面就好了
master
- Type: git (master)
- URL: https://git.coding.net/CocoaPods/Specs.git
- Path: /Users/zhangzhihong/.cocoapods/repos/master
1 repo
然後 cd 到項目app.xcodeproj的同目錄路徑
cd /Users/..
然後
pod install --verbose --no-repo-update
執行完就好了。
項目老方式打開項目還是有bug:
no such module "..."
其實項目已經可以運行但是:請看下面
官方文檔在pod install之後的操作是:
- open App.xcworkspace
到此就結束了,希望可以幫助到需要的人