无法读取数据,因为格式不正确。错误

时间:2017-02-26 13:55:31

标签: ios xcode info-plist

我收到了一个错误, 无法读取数据,因为格式不正确。 现在我正在通过swift制作iPhone应用程序。 我在我的应用程序的Info.plist中添加了几个代码,我删除了这些代码。 但是,当我想打开我的应用程序的Info.plist时,会发生此错误。我不知道为什么,因为我删除了我添加的所有代码。我认为格式确实是固定的。 我的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>UILaunchStoryboardName</key>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</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.0</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</dict>
</plist>

我该如何解决这个问题?

3 个答案:

答案 0 :(得分:3)

您已在info.plist文件中复制了密钥,在开头删除了以下密钥

UserNotifications

它将解决问题。

答案 1 :(得分:1)

尝试以下操作:

Right click on Info.plist -> Source Code -> Discard Change

答案 2 :(得分:0)

我当时正在构建Flutter项目,而关键 io.flutter.embedded_views_preview 缺少<string>问题,添加了<string></string>解决了我的问题,但我没有更新信息.plist虽然是由flutter创建的,但希望对使用flutter的人有所帮助