使用cocoapods时常见错误

作者: ibiaoma | 来源:发表于2016-06-02 14:51 被阅读14423次

    这些错误基本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、

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

    2018

    错误7、 RuntimeError - [Xcodeproj] Unknown object version.

    [Xcodeproj] Unknown object version. /Applications/CocoaPods.app/Contents/Res...

    原因: Xcode 版本和 CocoaPods 的版本不匹配,需要更新 CocoaPods 

    解决方法:终端输入命令 $ gem install cocoapods --pre

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

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

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

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

    补充:cocoapods也有了自己的客户端,可以直接使用  https://cocoapods.org/app

    相关文章

      网友评论

      • 呆北默:为什么我有end还是报错误4
      • Cocoa丶:经验之谈~
      • heiguoliangle:大佬,请问我按照文档配置后,为什么还是报错.
        ```
        [!] The version of CocoaPods used to generate the lockfile (1.3.1) is higher than the version of the current executable (1.2.0). Incompatibility issues may arise.
        [!] Unknown external source parameters for `test`: `{:sources=>["//Houda_ios/trunk/Spec"]}`

        [!] Your Podfile has had smart quotes sanitised. To avoid issues in the future, you should not use TextEdit for editing it. If you are not using TextEdit, you should turn off smart quotes in your editor of choice.
        ```
      • 叫我小灿吧:// mark :-
      • 世界未末日:非常好,解决了我的问题。
      • 歌白尼:很全 很好! mark!

      本文标题:使用cocoapods时常见错误

      本文链接:https://www.haomeiwen.com/subject/ihlkdttx.html