0

我在 macOS Sierra 上运行 Cocoapods 1.1.1 并使用 Xcode 7.3.1

我已经在 textedit 中使用以下文本以纯格式创建 Podfile:

 platform :ios, ‘9.3’

project ‘cd/ls/Desktop/rexpense-ios-rexpenseiOS-Rodrigo/Rexpense/Rexpense/Rexpense.xcodeproj

def common_pods
    pod 'AFNetworking', '~> 2.6.1'
    pod 'MagicalRecord', '~> 2.3'
    pod 'SVProgressHUD', '~> 1.1'
    pod 'SDWebImage', '~> 3.7.3'
    pod 'Rollbar', '~> 0.1.5'
    pod 'ABStaticTableViewController', '~> 1.1'
    pod 'GoogleAnalytics', '~> 3.13'
end

target 'Rexpense' do
common_pods

end

我得到以下错误语法:

[!] Invalid `Podfile` file: syntax error, unexpected tCONSTANT, expecting end-of-input
    pod 'AFNetworking', '~> 2.6.1'
                     ^.

 #  from /Users/rxasei/Podfile:23
 #  -------------------------------------------
 #  def common_pods
 >      pod 'AFNetworking', '~> 2.6.1'
 #      pod 'MagicalRecord', '~> 2.3'
 #  -------------------------------------------

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

1 回答 1

1

扩展 Gokul 的评论,这个错误是绝对正确的。引号可能看起来很标准,但 unicode 表示实际上是不同的,这与 TextEdit(以及实际上大多数其他 RTF 文本编辑器)处理引号的打开和关闭的方式有关。可能有一个选项可以关闭它,但我更喜欢使用专为编码设计的文本编辑器。

正如 Gokul 提到的那样,xcode 可以很好地完成这项工作,但 Sublime 文本更适合这项工作,而且您也没有为这样一个简单的任务运行相当消耗资源的 xcode。Sublime text 具有代码完成、语法高亮和自动缩进功能。在我看来,这是一个很棒的文本编辑器。我很欣赏这个答案是相当客观的,我相信其他人可能有他们喜欢的其他文本编辑器。

你可以在这里获得崇高的文字:https ://sublimetext.com/3

如果您使用 ST 打开您的 podfile,删除并重新键入所有单引号,您的错误应该会消失。

于 2016-11-21T14:06:11.227 回答