如何重新创建 ios/Runner/infor.plist 并在 flutter 中获取新的副本

问题描述

我在我的 info.plist 文件中搞砸了一点,在我开始收到错误后:

/ios/Runner/Info.plist: The operation Couldn’t be completed. (XCBUtil.PropertyListConversionError error 1.) (in target 'Runner' from project 'Runner')

所以我想我需要重新生成或重建info.plist文件,所以我想知道是否有任何方法可以使用Flutter命令重新创建它。

如果需要,这是我当前的 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>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</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>delivery_runner_driver</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>$(FlutteR_BUILD_NAME)</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundLeversion</key>
    <string>$(FlutteR_BUILD_NUMBER)</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>comgooglemaps</string>
        <string>baidumap</string>
        <string>iosamap</string>
        <string>waze</string>
        <string>yandexmaps</string>
        <string>yandexnavi</string>
        <string>citymapper</string>
        <string>mapswithme</string>
        <string>osmandmaps</string>
        <string>dgis</string>
    </array>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarappearance</key>
    <false/>
    <key>NSAppleMusicUsageDescription</key>
    <string>This app may needs to access your Apple Music.</string>
    <key>NSCalendarsUsageDescription</key>
    <string>This app may needs to access your calendars.</string>
    <key>NSContactsUsageDescription</key>
    <string>This app may needs to access your contacts.</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>This app needs access to location when in the background.</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>This app needs access to location when open.</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>This app may needs to access your Microphone if needed.</string>
    <key>NSMotionUsageDescription</key>
    <string>This app may needs to access your Motion Sensor.</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app may needs to access your PhotoLibrary.</string>
    <key>NsspeechRecognitionUsageDescription</key>
    <string>This app may needs to access Speech Recognition.</string>
</dict>
</plist>

注意: 我在构建时也收到此警告:

 error: Found non-key inside <dict> at line 48 / JSON error: JSON text did not start with array or object and option to allow fragments not set.

解决方法

只需删除 info.plist 文件并运行 flutter build ios