使用cocoapods时常见错误



这些错误基本cocoapods升级版本到1.0.0所造成的

错误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、   此问题 在3 之后,依然会出现,末尾加  end  完美解决

[!] 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

错误7、

Could not find 'cocoapods' (>= 0) among 11 total gem(s) (Gem::MissingSpecError)

Checked in 'GEM_PATH=/Users/tiamo/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', executegem envfor more information

from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:320:into_spec'

from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:65:ingem'

from /usr/local/bin/pod:22:in'

在终端输入 sudo gem install -n /usr/local/bin cocoapods,即可解决,用这句就好使,应该是没有成功写入那个文件,只是在缓存里写入了而已,所以关掉就不好使,但是如果用这句话的话就可以直接指入写入的文件。就防止了刚刚的问题。

错误8、

最近使用CocoaPods来添加第三方类库,无论是执行pod install还是pod update都卡在了Analyzing dependencies不动

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

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

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

或者

pod

install --no-repo-update

pod

update --no-repo-update

2.问题截图

解决办法 :  pod repo update   原因:你本地的repo库太长时间没有更新了

错误9、

Cocoapods 一直Setting up CocoaPods master repo 或者 Updating local specs repositories

解决方案:pod install 换成pod install --verbose --no-repo-update(pod update 换成pod update --no-repo-update)前面的命令被墙了

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

你可能感兴趣的:(使用cocoapods时常见错误)