Info.plist:由于格式不正确,无法读取数据

时间:2019-07-24 15:00:21

标签: ios xcode info.plist buildbox

我正在尝试在iPhone上测试我的项目(广告盒游戏), 导出在xcode上打开的项目,当我尝试运行它时,出现错误,如下所示:

  

错误:无法解析'/project/ios/BBplayer/Info.plist'的内容:由于数据格式不正确,因此无法读取数据。

我查看了过去的StackOverflow问题,发现了约7个相同问题的帖子,但仍无法解决此问题

有什么办法可以解决此问题?

xcode 10;

info.plist文件的内容作为源代码打开

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>en</string>
    <string>Ring & Wall</string>
    <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconName</key>
    <string>AppIcon</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
    <string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

2 个答案:

答案 0 :(得分:0)

您似乎一直在尝试将Info.plist编辑为源代码。别。您不知道该怎么做,而且很可能会弄乱格式并弄乱Info.plist。

在这种情况下,您有两个错误:

    if (names.length === 0) {
      return "no one likes this"
      }

  for (let i = 0; i < names.length; i++) {
    if (names.length === 1) {
      return names[i] + " likes this";
      } else if (names.length === 2) {
      return names[i] + " and " + names[1] + " like this";
      } else if (names.length === 3) {
      return names[i] + ", " + names[1] + " and " + names[2] + " like this";
      } else if (names.length > 3 ) {
      return names[i] + ", "+ names[1] + " and " + (names.length - 2) +" others" + " like this";
      }
    }
  } ```

1

<key>CFBundleDisplayName</key> <string>en</string> <string>Ring & Wall</string> 条目之后不能有两个<string>条目。

2

您不能在XML中使用与号。您的意思是<key>


我再说一遍,如果您只是不使用原始XML并让plist编辑器完成工作,那么这一切都不会发生。

答案 1 :(得分:0)

此行中的错误

<String>Ring & Wall</String>

删除和/或更改行     环与墙

我不好,这是愚蠢的错误:(

感谢@matt