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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31832538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:09:02  来源:igfitidea点击:

Error using Pod Install command on Podfile in Terminal

xcodeparsingcocoapodsipodpodfile

提问by Matt Falconer

I have installed Cocoapods, and created a Podfile using Atom containing the following lines:

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

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

Upon placing this file into my Xcode Project Root Directory, and running 'pod install' in Terminal. The following is shown:

将此文件放入我的 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.

[!] 您的 Podfile 已清除智能引号。为避免将来出现问题,您不应使用 TextEdit 对其进行编辑。如果您没有使用 TextEdit,您应该在您选择的编辑器中关闭智能引号。

Screenshot added

添加了截图

/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>'

I'm unsure what I have done incorrectly, if anyone could give me some advice - it would be really appreciated. Thank you.

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

回答by Ajith R Nayak

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 文件,因为 TextEdit 喜欢用更具图形吸引力的引号替换标准引号。这可能会导致 CocoaPods 混淆并显示错误,因此最好只使用 Xcode 或其他编程文本编辑器。

TextEdit:

文字编辑:

Using TextEdit will give you following,

使用 TextEdit 将为您提供以下信息,

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

To turn off smart quotes in TextEdit, goto

要在 TextEdit 中关闭智能引号,请转到

TextEdit > Preferences > New Document > Options

Xcode:

代码:

To get the correct quotes you shoulduse Xcode when opening Podfie:

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

pod 'Parse', '~> 1.7.1'

Terminal Commands to open using Xcode app:

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

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

回答by Denis Kutlubaev

I had this problem because of using one smart quote in a comment in podfile. I couldn't find a smart quote in my podfile for a while. There are two symbols for smart quotes: ‘ and '. Make sure both are removed from whole podfile.

我遇到这个问题是因为在 podfile 的评论中使用了一个智能引号。有一段时间我无法在我的 podfile 中找到智能报价。智能引号有两个符号:' 和 '。确保两者都从整个 podfile 中删除。

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

回答by Ammar Mujeeb

Incase someone using Jenkins CI and after correcting the Podfile too error doesnt resolves. Updating your cocoapods version on your slave can help get this error resolved. As jenkins is unable to pinpoint the issue and gives this generic error.

如果有人使用 Jenkins CI 并且在更正 Podfile 之后错误没有解决。更新您的从站上的 cocoapods 版本可以帮助解决此错误。由于詹金斯无法查明问题并给出了这个通用错误。