iOS安装相关

CocoaPods安装记录

2017-06-12  本文已影响13人  u14e

1. 替换Ruby源

将默认的 RubyGems 替换为ruby-china源

sudo gem sources -l

结果

*** CURRENT SOURCES ***

https://rubygems.org/
sudo gem sources --remove https://rubygems.org/
sudo gem sources -a http://gems.ruby-china.org/
*** CURRENT SOURCES ***

http://gems.ruby-china.org/

2. 更新gem

sudo gem update

3. 安装cocoapods

sudo gem install cocoapods

ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: cocoapods requires cocoapods-core (= 1.2.1), cocoapods-downloader (< 2.0, >= 1.1.3), cocoapods-trunk (< 2.0, >= 1.2.0), molinillo (~> 0.5.7), xcodeproj (< 2.0, >= 1.4.4), colored2 (~> 3.1), ruby-macho (~> 1.1)

sudo gem update --system
sudo gem install cocoapods

ERROR:While executing gem ... (Errno::EPERM)

Operation not permitted - /usr/bin/xcodeproj

sudo gem install -n /usr/local/bin cocoapods --pre

4. pod setup (慢)

使用国内镜像

pod repo remove master
pod repo add master [https://gitcafe.com/akuandev/Specs.git](https://gitcafe.com/akuandev/Specs.git)
git clone [https://git.coding.net/CocoaPods/Specs.git](https://git.coding.net/CocoaPods/Specs.git) ~/.cocoapods/repos/master

最后pod --versionpod repo update

5. 在项目根目录创建Podfile(每次修改都要pod update)

image.png
记得在platform :ios, '10.3'加上iOS版本号,否则会报错 image.png
现在可以pod updatepod installpod update时就包含了pod install

参考链接:

上一篇 下一篇

猜你喜欢

热点阅读