【问题标题】:Cocoa Pods Incompatible Character Encoding, When Installing RestKit [duplicate]安装RestKit时,Cocoa Pods不兼容的字符编码[重复]
【发布时间】:2015-04-29 13:17:54
【问题描述】:

嗨,我是 cocoaPods 的新手,这是我第一次尝试设置它,我试图将 RestKit 添加到我的项目中,但是当我运行 pod install 时,我收到下面的错误。

/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/user_interface/error_report.rb:13:in `report': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/command.rb:59:in `report_error'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:374:in `handle_exception'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:315:in `rescue in run'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:303:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/command.rb:46:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/bin/pod:44:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'

我还是新手,所以我不确定我哪里出错了,我在网上查了一下,发现了类似的问题,但没有一个问题能解决。我在终端中的所有命令都如下所示,以显示到目前为止我所做的事情,我认为我正确设置了可可豆荚,问题出在 pod 文件上,但我不确定。 pod文件的内容也在下面。感谢您的帮助。

终端:

CocoaPods 0.37.0.rc.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Setup completed
Some-MacBook-Pro:Articles Some$ touch podfile
Some-MacBook-Pro:Articles Some$ open -a TextEdit PodFile
Some-MacBook-Pro:Articles Some$ pod install
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/user_interface/error_report.rb:13:in `report': incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/command.rb:59:in `report_error'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:374:in `handle_exception'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:315:in `rescue in run'
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.8.1/lib/claide/command.rb:303:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/command.rb:46:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/bin/pod:44:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'
Some-MacBook-Pro:Articles Some$ open a- TextEdit PodFile
The files /Users/Some/Desktop/RW-Tutorials/Articles/a- and /Users/Some/Desktop/RW-Tutorials/Articles/TextEdit do not exist.
Some-MacBook-Pro:Articles Some$ 

Pod 文件:

platform :iOS, ‘8.0’
pod ‘RestKit’, ’~> 0.20.0’

【问题讨论】:

  • pod init 你必须给,然后只有它会创建一个 pod
  • 试试platform :iOS, '8.0' pod 'RestKit', '~&gt; 0.20.0'(注意使用的引号字符)

标签: ios objective-c cocoa cocoapods


【解决方案1】:

将您的 重新格式化为 '

复制/粘贴下面的“to”示例或退格您的 并手动输入'

platform :iOS, ‘8.0’
pod ‘RestKit’, ’~> 0.20.0’

platform :iOS, '8.0'
pod 'RestKit', '~> 0.20.0'

然后运行您的 pod 安装/更新

【讨论】:

  • 这成功了谢谢你:)。
  • 这个已经不止一次咬我了:-D
  • 是的,我的问题就是这种情况。
【解决方案2】:

终端并输入以下命令:

sudo gem update --system

接下来,您需要安装 CocoaPods。在终端中输入此命令:

sudo gem install cocoapods

在终端输入此命令完成CocoaPods的设置:

pod setup

打开终端并使用 cd 命令导航到包含您的项目的目录:

cd ~/Path/To/Folder/Containing/yourprojectName

接下来输入这个命令:

pod init

键入此命令以打开 Podfile 进行编辑:

open -a Xcode Podfile

将这些文件添加到您的 pod 文件中

platform :iOS, '8.0'
pod 'RestKit', '~> 0.20.0'

那么你需要输入以下内容完成

pod install

之后打开项目文件夹中的工作区

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-25
    • 1970-01-01
    • 2012-07-18
    • 1970-01-01
    • 1970-01-01
    • 2020-06-16
    • 2015-11-04
    • 2020-03-27
    相关资源
    最近更新 更多