Podfile中的Cocoapods语法错误

问题描述 投票:0回答:1

我在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.
cocoapods podfile
1个回答
1
投票

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

正如Gokul所提到的,xcode可以很好地完成工作,但是Sublime文本对于这项工作来说更加优化,而且你也没有为这么简单的任务运行一个相当资源饥饿的xcode。 Sublime文本具有代码完成,语法突出显示和自动缩进功能。在我看来,这是一个很棒的文本编辑器。我很欣赏这个答案是相当客观的,我相信其他人可能会有其他他们喜欢的文本编辑器。

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

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

© www.soinside.com 2019 - 2024. All rights reserved.