Info.plist not in correct format

2019-04-06 18:32发布

I was working through my iOS Xcode project just fine, and then all of a sudden when I tried to run it, I started getting the error below:

error: couldn't parse contents of '/Users/pavitarsidhu/Desktop/AmigoDash/SidebarDemo/AmigoDash-Info.plist': The data couldn’t be read because it isn’t in the correct format.

I'm really confused. I've looked at the past StackOverflow questions and still have not been able to fix this. Is there anyway to just generate a new infoplist? What do you guys think?

3条回答
forever°为你锁心
2楼-- · 2019-04-06 19:13

A plist file is an XML document in a tightly specified format; both XML and the Property List structure have very strict rules. You can easily mess things up by accident if you attempt to edit the info.plist manually (i.e., as text) by saying Open As > Source Code:

enter image description here

You are unlikely to get this format right. Thus, you should always edit the info.plist with Open As > Property List:

enter image description here

This allows the property list editor to generate the XML for you, and it is unlikely to make a mistake in the resulting XML structure. Of course I suppose you could still mess up the value of something...

查看更多
女痞
3楼-- · 2019-04-06 19:20

I had a merge conflict and didn't realize it so there were git annotations in the file. I couldn't open it as a property list but I opened as source code and fixed the issue that way.

查看更多
我命由我不由天
4楼-- · 2019-04-06 19:21

I had this same issue and it was because plist files do not like &. You have to use & instead of an ampersand.

查看更多
登录 后发表回答