ld: library not found for -lPods- -AFNetworking

在从gitHup上拉代码后,等你刚pod install 安装了程序依赖的pod 库之后,会发现怎么运行xcode 都 编译报上面这句错ld: library not found for -lPods-你的工程名 -AFNetworking ,就是link的时候找不到第三方库。

解决方案如下:

我研究了一星期 ,试了很多次,最后发现是因为我新电脑默认安装的pod 版本是 0.39.0 而 我们公司git仓库上是0.35.0,就是因为我用的pod 版本过高,所以在pod install 后就会编译报错。

查看pod 版本在终端下输入 pod --version

(国内的pod安装大家也知道一般都比较慢,另外,如果你pod install 比较慢的话,那就改你的dns 加上114.114.114.114.)

废话不多说,直接上我这个问题的最终解决方案

1.打开终端,查看安装gem 程序列表。

输入gem list 

会发现输出如下:

cocoapods (0.39.0)

cocoapods-core (0.39.0)

cocoapods-downloader (0.9.3, 0.8.1)

cocoapods-plugins (0.4.2, 0.3.2)

cocoapods-search (0.1.0)

cocoapods-stats (0.6.2)

cocoapods-trunk (0.6.4, 0.4.1)


2.把如下带有cococspods 的程序都给卸载掉,然后,重新安装指定的Pod版本

卸载命令:sudo gem uninstall cocoapods

或者sudo gem uninstall cocoapods -v 0.35.0

(后面加-v 是指定版本,不加的话,就可以选择卸载所有的)

会看到例如下面输出 

wangfeideMacBook-Pro:iOS-Application wangfei$ sudo gem uninstall cocoapods

Password:

Remove executables:

pod, sandbox-pod


in addition to the gem? [Yn]  y

Removing pod

Removing sandbox-pod

Successfully uninstalled cocoapods-0.39.0

wangfeideMacBook-Pro:iOS-Application wangfei$ sudo gem uninstall cocoapods-core

Successfully uninstalled cocoapods-core-0.39.0

wangfeideMacBook-Pro:iOS-Application wangfei$ sudo gem uninstall cocoapods-downloader


Select gem to uninstall:

 1. cocoapods-downloader-0.8.1

 2. cocoapods-downloader-0.9.3

 3. All versions

> 3

Successfully uninstalled cocoapods-downloader-0.8.1

Successfully uninstalled cocoapods-downloader-0.9.3

wangfeideMacBook-Pro:iOS-Application wangfei$ sudo gem uninstall cocoapods-plugins


Select gem to uninstall:

 1. cocoapods-plugins-0.3.2

 2. cocoapods-plugins-0.4.2

 3. All versions

> 3

Successfully uninstalled cocoapods-plugins-0.3.2

Successfully uninstalled cocoapods-plugins-0.4.2

wangfeideMacBook-Pro:iOS-Application wangfei$ sudo gem uninstall cocoapods-search

Successfully uninstalled cocoapods-search-0.1.0

wangfeideMacBook-Pro:iOS-Application wangfei$ sudo gem uninstall cocoapods-stats

Successfully uninstalled cocoapods-stats-0.6.2

wangfeideMacBook-Pro:iOS-Application wangfei$ sudo gem uninstall cocoapods-trunk

 

Select gem to uninstall:

 1. cocoapods-trunk-0.4.1

 2. cocoapods-trunk-0.6.4

 3. All versions

> 3

Successfully uninstalled cocoapods-trunk-0.4.1

Successfully uninstalled cocoapods-trunk-0.6.4

wangfeideMacBook-Pro:iOS-Application wangfei$ sudo gem uninstall cocoapods-try


Select gem to uninstall:

 1. cocoapods-try-0.4.5

 2. cocoapods-try-0.5.1

> 3

Successfully uninstalled cocoapods-try-0.4.5

Successfully uninstalled cocoapods-try-0.5.1


3.第三步,就是重新安装指定pod 版本与你git hub里代码原来用的是哪一个版本一致(我这里是从0.39.0降到0.35.0)

在终端输出命令:sudo gem install cocoapods -v 0.35.0

4.安装完毕,检查版本

在终端输入:pod --version 查看

输出如下:

wangfeideMacBook-Pro:iOS-Application wangfei$ pod --version

0.35.0


5.好了,然后,再回到你项目目录,最好删掉原来项目,重新拉取下代码,再重新pod install .

问题就解决了。


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值