You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS项目运行报错:Info.plist第34行存在非键元素求助

iOS项目运行报错:Info.plist结构错误修复方案

错误原因分析

报错提示Info.plist: Property List error: Found non-key inside <dict> at line 34,核心问题是Info.plist的XML结构不符合plist字典规范——<dict>标签下必须严格遵循「<key> + 对应值类型(如<string>/<array>)」的成对结构,不能出现孤立的<key>或错位的键值对。

查看你的plist代码,问题出在这一段:

<key>UISupportedInterfaceOrientations</key>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires Mic permission.</string>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

<key>UISupportedInterfaceOrientations</key>定义后,没有立即跟上它对应的<array>值,反而插入了NSMicrophoneUsageDescription的键值对,导致结构混乱:UISupportedInterfaceOrientations的key没有对应值,而NSMicrophoneUsageDescription的key被错误地放在了前一个key的value位置,触发了plist解析错误。

修正后的完整Info.plist代码

将NSMicrophoneUsageDescription的键值对移到正确位置(确保每个key都紧跟对应的value),修正后的代码如下:

<?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>CFBundleDisplayName</key>
    <string>Quezzy</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>quezzy</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>NSMicrophoneUsageDescription</key>
    <string>This app requires Mic permission.</string>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>CADisableMinimumFrameDurationOnPhone</key>
    <true/>
    <key>UIApplicationSupportsIndirectInputEvents</key>
    <true/>
</dict>
</plist>

验证方法

替换后重新编译项目,若仍有报错,可通过Xcode的「File > Open」直接打开Info.plist,切换到「Property List」可视化视图,Xcode会自动高亮显示结构错误的位置,方便进一步排查。

内容的提问来源于stack exchange,提问作者Rio

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 11:05:18