[英]Invalid 'Podfile' file syntax error, unexpected $undefined, expecting '}'
I am trying to install a pod in project. 我正在尝试在项目中安装pod。 But i am getting this error:
但我得到这个错误:
Invalid 'Podfile' file syntax error, unexpected $undefined, expecting '}'.
“Podfile”文件语法错误无效,意外$ undefined,期待'}'。
Podfile contains: Podfile包含:
platform :ios, '7.0' pod 'RestKit', '0.21.0'
The terminal shows following message: 终端显示以下消息:
[!] Invalid `Podfile` file: compile error
/Users/work/Desktop/tg/RESTKitDemo/Podfile:1: syntax error, unexpected $undefined, expecting '}'
{\rtf1\ansi\ansicpg1252\cocoartf1265
^. Updating CocoaPods might fix the issue.
# from /Users/work/Desktop/tg/RESTKitDemo/Podfile:1
# -------------------------------------------
> {\rtf1\ansi\ansicpg1252\cocoartf1265
# {\fonttbl\f0\fmodern\fcharset0 Courier;}
# -------------------------------------------
Can i know what is the problem with my podfile? 我可以知道我的podfile有什么问题吗?
Assuming you correctly copied your Podfile over there needs to be a newline between those two lines. 假设您正确复制了Podfile,那么这两行之间需要有换行符。
platform :ios, '7.0'
pod 'RestKit', '0.21.0'
Also as of a relatively new version of CocoaPods you actually don't need that first line, the command line tool will determine the correct OS based off of your project's settings. 此外,作为一个相对较新版本的CocoaPods,您实际上不需要第一行,命令行工具将根据您的项目设置确定正确的操作系统。
Edit: 编辑:
From the new output you posted it looks like your Podfile
isn't actually a plain text file. 从您发布的新输出看起来,您的
Podfile
实际上不是纯文本文件。 You should recreate it in an editor like Sublime Text and make sure it saves as a plain text file. 您应该在Sublime Text等编辑器中重新创建它,并确保它保存为纯文本文件。
I got error 我收到了错误
Invalid `Podfile` file: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
pod 'MBProgressHUD'
becasue I was declaring Pod files like 因为我正在声明像Pod这样的文件
pod 'SlideMenuControllerSwift',
pod 'MBProgressHUD'
pod 'SDWebImage'
there is one "," (colon mark) in above podfile name pod 'SlideMenuControllerSwift', . 上面的podfile名称pod“SlideMenuControllerSwift”中有一个“,”(冒号)。 I just removed the colon mark.
我刚删除了冒号。 It worked.
有效。
correct way: 正确方法:
pod 'SlideMenuControllerSwift'
pod 'MBProgressHUD'
pod 'SDWebImage'
pod文件中不允许使用任何特殊字符或任何其他内容,除了我们正在集成的pod的名称,如果我们输入任何字符,如\\,等等,它可能会导致以下错误。
I was faced same problem when, I changed my MAC. 当我改变我的MAC时,我遇到了同样的问题。
1- Make setup - Pod setup or update 1-进行设置 - Pod设置或更新
So I created a new test project -- And open terminal
Run these command 所以我创建了一个新的测试项目 - 并打开
terminal
运行这些命令
cd /path your project
pod init
// add any pod in your pod file
pod install
and then you can update pod
in your old project . 然后您可以
update pod
旧项目中的update pod
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.