首页 > 解决方案 > 将flutter项目导入MacOS并运行时出现Info.plist错误

问题描述

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

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”是因为我的一个包需要它。

标签: iosxcodeflutter

解决方案


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


推荐阅读