在终端的 Podfile 上使用 Pod Install 命令时出错

Error using Pod Install command on Podfile in Terminal

我已经安装了 Cocoapods,并使用包含以下行的 Atom 创建了一个 Podfile:

pod ‘Parse’, ‘~> 1.7.1′
pod ‘ParseUI’, ‘~> 1.1.3′

将此文件放入我的 Xcode 项目根目录,并在终端中 运行 'pod install'。显示如下:

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

/Library/Ruby/Gems/2.0.0/gems/cocoapods-core-0.38.2/lib/cocoapods-core/standard_error.rb:87:in `message': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:367:in `handle_exception'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:315:in `rescue in run'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:303:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.2/lib/cocoapods/command.rb:48:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.38.2/bin/pod:44:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'

我不确定我做错了什么,如果有人能给我一些建议 - 将不胜感激。谢谢。

You shouldn’t use TextEdit to edit the pod file because TextEdit likes to replace standard quotes with more graphically appealing quotes. This can cause CocoaPods to get confused and display errors, so it’s best to just use Xcode or another programming text editor.

文本编辑:

使用 TextEdit 会给你以下内容,

pod ‘Parse’, ‘~> 1.7.1′    //notice the quotes

要在 TextEdit 中关闭弯引号,转到

TextEdit > Preferences > New Document > Options

Xcode:

要获得正确的报价,您应该在打开 Podfie 时使用 Xcode:

pod 'Parse', '~> 1.7.1'

使用 Xcode 应用打开的终端命令:

$ touch Podfile  //OR $ cd <parentDirectory of Podfile>
$ open -a Xcode Podfile

我遇到这个问题是因为在 podfile 的评论中使用了一个智能引号。有一段时间我在我的播客文件中找不到聪明的引述。智能引号有两个符号:‘和’。确保两者都从整个 podfile 中删除。

    # Espressif’s ESP-TOUCH protocol implements Smart Config ...

万一有人使用 Jenkins CI 并且在更正 Podfile 后错误也没有解决。更新你的 slave 上的 cocoapods 版本可以帮助解决这个错误。由于詹金斯无法查明问题并给出了这个一般错误。