将flutter项目导入MacOS并运行时出现Info.plist错误

Posted

技术标签:

【中文标题】将flutter项目导入MacOS并运行时出现Info.plist错误【英文标题】:Info.plist error when importing flutter project into MacOS and running it 【发布时间】:2021-07-02 12:34:25 【问题描述】:

我运行了我的颤振项目,但它给了我这个错误:

Error: unable to read property list from file: /Users/myname/Developer/appname/ios/Runner/Info.plist: 
The operation couldn't be completed. (XCBUtil.PropertyListConversionError error 1.)

这是我的 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>LSApplicationQueriesSchemes</key>
    <array>
    <string>https</string>
    <string>http</string>
    <string>tel</string>
    <string>mailto</string>
    </array> 
    <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>apitesting</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>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>io.flutter.embedded_views_preview</key>
    <String>YES<String>
</dict>
</plist>

该应用程序通过 android 模拟器在 VS Code 上运行良好,但是当我在 Xcode 中运行项目时,它给出了这个错误。当我不得不对其进行一些配置时,我自己进行了一些编辑:

我添加的 LSApplicationQueriesSchemes 和“https、http、tel、mailto”是因为我的一个包需要它。

【问题讨论】:

【参考方案1】:

好的,我发现了错误。我使用的依赖项(WebView)在不应该大写的情况下将字符串大写时出错。他们也忘记在 YES 字符串周围加上引号。

【讨论】:

以上是关于将flutter项目导入MacOS并运行时出现Info.plist错误的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio 在运行 Flutter 项目时出现问题

尝试运行并构建到 iPhone 模拟器时出现 Flutter Xcode 致命错误

为 android 配置 Flutter“sign_in_with_apple”时出现问题

在 Android Studio 中设置 Flutter 时出现问题

Flutter/macOS - 应用程序仍然包含默认的签名标识符

[为什么在macOS Catalina上为Angular项目运行npm install时出现这些故障?