给老项目添加cocoapods之旅
来源:互联网 发布:blast软件下载 编辑:程序博客网 时间:2024/04/28 03:47
我是对之前的一个老项目添加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,右键显示包内容
,用文本编辑器打开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
- 给老项目添加cocoapods之旅
- iOS项目添加CocoaPods
- iOS开发:给项目工程里面添加Podfile配置文件,以及CocoaPods的简单使用
- 最近项目中给图片添加水印老失败,报错信息如下
- 给工具类添加CocoaPods支持
- Unity之一天一个技术点(十五)---给unity3d的老版动画中,添加事件的方法
- Xcode: 给项目添加framework
- 给vue项目添加ESLint
- 使用CocoaPods给项目配置第三方框架
- 使用CocoaPods给swift项目配置第三方swift框架
- 002 走上移动开发之安卓项目实战(百度地图:给地图添加标注物)
- android项目 之 记事本(12) ----- 图片的等比例缩放及给图片添加边框
- HOWTO: 给 ATL 项目添加 MFC 支持
- HOWTO: 给 ATL 项目添加 MFC 支持
- 给 ATL EXE 项目添加 MFC 支持
- Android Fragment---给动作栏添加项目
- 给ATL项目添加MFC支持
- Android Fragment---给动作栏添加项目
- hdu1203 I NEED A OFFER! (01背包)
- 快速排序(C++实现)
- Test
- Tomact跨域
- Android程序员学PHP开发(7)-强转变量类型判断-PhpStorm
- 给老项目添加cocoapods之旅
- artTemplate 怎么拼html进去
- PHP递归返回值的问题
- python中的变量赋值,浅拷贝,深拷贝
- 【appium】java.lang.UnsupportedClassVersionError: io/appium/java_client/AppiumDriver :
- IT人员求职招聘网站
- CI框架 微信扫码支付模式二
- 备用
- iOS本地数据安全存储