Info.plist 无法读取,因为格式不正确

Info.plist couldn't be read because it isn't in the correct format

我的问题是打开 Info.plist 文件时出现此错误:

Info.plist couldn't be read because it isn't in the correct format

当从 vs 为 mac 或 xcode 打开时,plist 文件可能有什么问题?这是我的 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>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</integer>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>MinimumOSVersion</key>
    <string>10.3</string>
    <key>CFBundleName</key>
    <string>MovesaGarantias</string>
    <key>CFBundleDisplayName</key>
    <string>MovesaGarantias</string>
    <key>CFBundleIdentifier</key>
    <string>com.yourcompany.MovesaGarantias</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
  <key>NSLocationAlwaysUsageDescription</key>
  <string>Can we use your location at all times?</string>
  <key>NSLocationWhenInUseUsageDescription</key>
  <string>Can we use your location when your app is being used?</string>
  <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
  <string>Can we use your location at all times?</string>
  <key>NSCalendarsUsageDescription</key>
  <string>Needs Calendar Permission</string>
  <key>CFBundleIconFiles</key>
    <array>
        <string>Icon-60@2x</string>
        <string>Icon-60@3x</string>
        <string>Icon-76</string>
        <string>Icon-76@2x</string>
        <string>Default</string>
        <string>Default@2x</string>
        <string>Default-568h@2x</string>
        <string>Default-Portrait</string>
        <string>Default-Portrait@2x</string>
        <string>Icon-Small-40</string>
        <string>Icon-Small-40@2x</string>
        <string>Icon-Small-40@3x</string>
        <string>Icon-Small</string>
        <string>Icon-Small@2x</string>
        <string>Icon-Small@3x</string>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>   
    <key>XSLaunchImageAssets</key>
    <string>Resources/Media.xcassets/LaunchImages.launchimage</string>
</dict>
</plist>

错误还表示标签密钥在 Xamarin 与 Mac 上不受支持。

我认为问题在于您有一个值数组,但第 34 行没有键:

  <key>NSCalendarsUsageDescription</key>
  <string>Needs Calendar Permission</string>
    <array>
        <string>Icon-60@2x</string>

<array> 标签之前,您需要有一个 <key>Keyname</key> 条目。

现在您已经更正了您的 plist 文件,它是有效的并且可以在 Xcode 中正常打开: