Xcode 正在构建项目,当构建成功时,我收到此消息“捆绑包的 Info.plist 不包含 CFBundleVersion 键或其值不是字符串”。那什么意识。这是我的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></key>
<string></string>
<key>Additional_Version_String</key>
<string>Updated on build</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
<dict/>
<key>CFBundleIcons~ipad</key>
<dict/>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>Commit_Short_Hash</key>
<string>Updated on build</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSContactsUsageDescription</key>
<string>Vialer needs access to your contacts to make calling to your contacts possible</string>
<key>NSMicrophoneUsageDescription</key>
<string>Vialer needs access to your microphone to make calling possible</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>fetch</string>
<string>remote-notification</string>
<string>voip</string>
</array>
<key>UIMainStoryboardFile</key>
<string>MainStoryboard</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIRequiresPersistentWiFi</key>
<true/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackTranslucent</string>
<key>UIStatusBarTintParameters</key>
<dict>
<key>UINavigationBar</key>
<dict>
<key>Style</key>
<string>UIBarStyleDefault</string>
<key>Translucent</key>
<true/>
</dict>
</dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
</plist>
我也有同样的问题。
我通过模拟器菜单 -> 硬件 -> 删除所有内容和设置来修复它。
也许这是一个模拟器错误。
我的解决方法是向目标添加内部版本号。 单击您的目标,转到“常规”,然后在“身份”下方是“构建”字段。
如果您在 Flutter 中遇到此问题,可以通过以下方式解决:
删除 Flutter 项目中的 ios 文件夹,然后运行:
flutter create .
这将再次重新生成 iOS 项目文件,然后运行。
flutter run
您可以使用 agvtool 来修复这些错误:https://developer.apple.com/library/archive/qa/qa1827/_index.html
因此,要解决 CFBundleVersion 问题,请打开终端,转到项目根目录(iOS 项目),然后键入以下命令:
agvtool new-version -all 2.6.9
然后按回车键。
我只是编辑项目的“.plist”文件并添加了具有某些值的
CFBundleShortVersionString
条目。
只需将构建版本插入到您的项目中
以代码模式添加到 info.plist 对我有用
<plist version="1.0">
<string>1.0</string>
</plist>
就我而言,我的 info.plist 通过 VSCODE 中的 xml 格式化程序进行格式化。格式化的 xml 文档是有效的 xml 文档,但不知何故,Xcode 不接受它。
例如格式化的 xml :
<key>
CFBundleDisplayName
</key>
<string>
MyApp
</string>
但是 Xcode 接受的 xml :
<key>CFBundleDisplayName</key>
<string>MyApp</string>
对我来说,它崩溃是因为缺少正确链接的 SDK,但我忘记将其嵌入到应用程序中。应用程序通常应该崩溃并显示
dyld: not loaded ...
,但相反,它显示了这个完全不相关的 Info.plist 问题。 🤯
也就是说,我想说这是苹果方面的一个错误,几乎所有阻止应用程序启动的东西都会产生这个错误。
Xcode 14.2,原生 M1 模式。
希望有帮助。