Cocoapods集成第三方库,以及一些error解决

1.新建一个项目Test

2.终端中,cd到项目总目录(注意:包含PodTest文件夹、PodTest.xcodeproj、PodTestTest的那个总目录)

cd /Users/DaiLiang/Desktop/Test

3.建立Podfile(配置文件),终端输入vim Podfile

键盘输入i,进入编辑模式,输入

$  platform :ios, '7.0'

$ pod 'MBProgressHUD', '~> 0.8'

4.输入完成,然后按Esc,并且输入  “  :”  号进入vim命令模式,然后在冒号后边输入wq(注意:键盘输入 :后,才能输入wq。回车后发现PodTest项目总目录中多一个Podfile文件)

5.确定终端cd到项目总目录,然后输入pod install



错误1、

当写在Podfile文件中的第三方框架,不能使用,找不到时

查看Pods文件夹,是否下载了所需要的第三方框架,没有的话就 pod update

错误2、

Could not automatically select an Xcode project. Specify one in your Podfile like so:xcodeproj 'path/to/Project.xcodeproj'

在Podfile文件里指定下工程目录就行了

xcodeproj 'Demo/Demo.xcodeproj'

但是如果cocoapods版本为(1.0.0或更高)的话,可能会有以下警告

[!] xcodeproj was renamed to `project`. Please use that from now on.

这时只需要把xcodeproj改为 project就行了

project 'Demo/Demo.project'

错误3、

The dependency `AFNetworking (~> 3.0)` is not used in any concrete target.

在Podfile中添加

target‘项目名'do  (如  target 'Demo' do )

错误4、

[!] Invalid `Podfile` file: syntax error, unexpected end-of-input, expecting keyword_end.

在Podfile的末尾添加 end

错误5、

Unable to find the Xcode project `/Volumes/BIAO/iOS/code/MBWB.xcodeproj` for the target `Pods`.

在Podfile中 将  project 'Demo/Demo.project’  改成  project 'Demo.project'

错误6、

build diff: /../Podfile.lock: No such file or directory

在工程设置中的Build Phases下删除Check Pods Manifest.lock及Copy Pods Resources

还有一个更新慢的问题:无论是执行pod install还是pod update都卡在了Analyzing dependencies不动

原因在于当执行以上两个命令的时候会升级CocoaPods的spec仓库,加一个参数可以省略这一步,然后速度就会提升不少。加参数的命令如下:

pod install --verbose --no-repo-update

pod update --verbose --no-repo-update

你可能感兴趣的:(Cocoapods集成第三方库,以及一些error解决)