给老项目添加cocoapods之旅
2017-01-12 15:53
260 查看
我是对之前的一个老项目添加cocoapods来替换手动添加的三方库,一切都很顺利,编译也没问题,结果一运行,
我当时就懵逼了,急的我,我以为pod导入三方库有问题,我就删除了重新导入,还是不行,我以为是cocoapods出了问题,ok,捣鼓一下,结果把cocoapods搞出了事,花了两天时间,最后找到了原因,都是“Other
Linker Flags”
下面有个概念,可以看看:
http://blog.csdn.net/cjh965063777/article/details/51880966
找到原因就好办了,顺便还可以解决pod里面出现的警告:
[!] The `Paopao [Debug]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [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
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [Release]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [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
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
简单粗暴法:点击项目文件 project.xcodeproj,右键
repo update --verbose,警告没了,问题也解决了,整个人都好了。。。。
------------------------------------下面是自己挖的坑,cocoapods走一遍----------------------------------
首先cocoapods无缘无故出现问题不要动不动就卸载,事情越搞越大,无非就是更新一下
sudo gem install -n /usr/local/bin cocoapods
1,简单说下cocoapods的安装吧,淘宝源也不能用了,所以替换一下:
gem sources --remove https://rubygems.org/
gem sources -a https://gems.ruby-china.org/
查看下替换成功没,打印出来就替换成功了:
gem sources -l
2.更新升级gem,如果它的版本过低也可能导致安装失败,在终端输入以下命令:
sudo gem update --system
3.安装CocoaPods:
OS X 10.11以前,在终端输入以下命令:
sudo gem install cocoapods
OS X 10.11以后,在终端输入以下命令:
sudo gem install -n /usr/local/bin cocoapods
4.初始化:
在终端输入以下命令:
pod setup
这一步是问题最多的一步,下面慢慢说
查看下版本,是否安装成功,我目前的版本是:1.2.0.beta.3
pod --version
5.问题梳理:
(1)在终端输入以下命令:
pod repo list
结果为0 repos时说明安装不成功,自己可以查看下自己的安装步骤,看看是哪一步出现了问题。
(2)出现以下错误:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
在网上寻找的解决方法:
在终端中输入:sudo nvram boot-args="rootless=0"; sudo reboot
然后你的电脑会重启
之后再输入sudo gem install cocoapods -V
就可以了。
(3)pod setup时出现以下错误:
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master
Cloning into 'master'...
error: RPC failed; curl 56 SSLRead() return error -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.
自己按照提示在终端输入以下命令:
pod repo add master https://github.com/CocoaPods/Specs.git
还是报错!
在网上查到的解决办法:在终端输入以下命令:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developers
后面的地址你可以打开Xcode显示包内容,找到那个文件夹拖到终端里面。
(4)试过以上所有解决办法,还是没有安装成功:
重新安装(其实我就是这样安装成功的):
首先,删除.cocoapods目录,在终端输入以下命令:
sudo rm -rf ~/.cocoapods/
然后,重新下载安装,在终端输入以下命令:
pod setup
如果这都还不行,就只有放终极绝招了,亲测有效
sudo rm -rf ~/.cocoapods/
$ sudo gem install -n /usr/local/bin cocoapods
$ Git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
最后再pod setup 一下,应该是没问题了
下面有两篇很不错的文章,关于cocoapods的
http://www.jianshu.com/p/b5315bf42975
http://www.jianshu.com/p/ffc0a67d6d75
我当时就懵逼了,急的我,我以为pod导入三方库有问题,我就删除了重新导入,还是不行,我以为是cocoapods出了问题,ok,捣鼓一下,结果把cocoapods搞出了事,花了两天时间,最后找到了原因,都是“Other
Linker Flags”
下面有个概念,可以看看:
http://blog.csdn.net/cjh965063777/article/details/51880966
找到原因就好办了,顺便还可以解决pod里面出现的警告:
[!] The `Paopao [Debug]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [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
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [Release]` target overrides the `PODS_ROOT` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `Paopao [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
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
简单粗暴法:点击项目文件 project.xcodeproj,右键
显示包内容,用文本编辑器打开
project.pbxproj,删除
OTHER_LDFLAGS的地方,保存,pod
repo update --verbose,警告没了,问题也解决了,整个人都好了。。。。
------------------------------------下面是自己挖的坑,cocoapods走一遍----------------------------------
首先cocoapods无缘无故出现问题不要动不动就卸载,事情越搞越大,无非就是更新一下
sudo gem install -n /usr/local/bin cocoapods
1,简单说下cocoapods的安装吧,淘宝源也不能用了,所以替换一下:
gem sources --remove https://rubygems.org/
gem sources -a https://gems.ruby-china.org/
查看下替换成功没,打印出来就替换成功了:
gem sources -l
2.更新升级gem,如果它的版本过低也可能导致安装失败,在终端输入以下命令:
sudo gem update --system
3.安装CocoaPods:
OS X 10.11以前,在终端输入以下命令:
sudo gem install cocoapods
OS X 10.11以后,在终端输入以下命令:
sudo gem install -n /usr/local/bin cocoapods
4.初始化:
在终端输入以下命令:
pod setup
这一步是问题最多的一步,下面慢慢说
查看下版本,是否安装成功,我目前的版本是:1.2.0.beta.3
pod --version
5.问题梳理:
(1)在终端输入以下命令:
pod repo list
结果为0 repos时说明安装不成功,自己可以查看下自己的安装步骤,看看是哪一步出现了问题。
(2)出现以下错误:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
在网上寻找的解决方法:
在终端中输入:sudo nvram boot-args="rootless=0"; sudo reboot
然后你的电脑会重启
之后再输入sudo gem install cocoapods -V
就可以了。
(3)pod setup时出现以下错误:
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master
Cloning into 'master'...
error: RPC failed; curl 56 SSLRead() return error -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.
自己按照提示在终端输入以下命令:
pod repo add master https://github.com/CocoaPods/Specs.git
还是报错!
在网上查到的解决办法:在终端输入以下命令:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developers
后面的地址你可以打开Xcode显示包内容,找到那个文件夹拖到终端里面。
(4)试过以上所有解决办法,还是没有安装成功:
重新安装(其实我就是这样安装成功的):
首先,删除.cocoapods目录,在终端输入以下命令:
sudo rm -rf ~/.cocoapods/
然后,重新下载安装,在终端输入以下命令:
pod setup
如果这都还不行,就只有放终极绝招了,亲测有效
sudo rm -rf ~/.cocoapods/
$ sudo gem install -n /usr/local/bin cocoapods
$ Git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
最后再pod setup 一下,应该是没问题了
下面有两篇很不错的文章,关于cocoapods的
http://www.jianshu.com/p/b5315bf42975
http://www.jianshu.com/p/ffc0a67d6d75
相关文章推荐
- 为VS.NET的部署项目添加卸载快捷方式
- 如何在类库项目中添加配置文件??????
- 例子代码:添加项目到收藏夹
- javascript实现爱你在FF IE下都有效的添加一个项目
- 在已经建好的工程项目中需要添加BCG功能!
- javascript实现爱你在FF IE下都有效的添加一个项目
- 智能设备项目: 手工添加所需控件的简单示例
- [教程]添加yueue.ADOKeycap数据库组件到您的项目
- 添加项目到vss
- 使用websphere开发J2EE项目时,在服务器配置文件->“环境”->“类路径”中添加的ORACLE的JDBC文件classes12.zip文件是否有效呢?
- ASP.NET的WEB项目不能添加WEB用户控件的解决
- 在VC++项目中为MDI主框架窗口添加位图
- 向CVS添加新的项目模块
- 改变ListBox中Items的颜色,并且为ListBox中的项目添加图片。
- 我是怎样把 assemblies 添加到 .NET 项目引用的?
- 如何在类库项目中添加Web窗体文件
- 编译.NET项目提示“找不到系统命名空间,请添加系统组件的引用”问题的解决方法(该组件已被该项目正确引用)
- 智能设备项目: 手工添加所需控件的简单示例
- ActionScript 3.0 Cookbook 6.1添加一个项目到可视化列表中
- HOWTO: 给 ATL 项目添加 MFC 支持