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

Xamarin iOS应用提示缺少CFBundleIdentifier,但info.plist中已配置该字段

解决Xamarin iOS应用"CFBundleIdentifier缺失"错误(Info.plist已配置该字段的情况)

问题详情

运行Xamarin iOS应用MyCoffeeApp.iOS时,收到以下错误:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.Shared.targets(3,3): Error: A bundle identifier is required. Either add an 'ApplicationId' property in the project file, or add a 'CFBundleIdentifier' entry in the project's Info.plist file. (MyCoffeeApp.iOS)

已确认Info.plist中CFBundleIdentifier字段存在,但错误依旧。

可行解决方案

  • 检查Info.plist的源代码格式
    可视化编辑器显示的内容可能和实际XML代码不一致,右键Info.plist选择"打开方式"→"源代码编辑器",确认CFBundleIdentifier的节点格式正确,示例如下:

    <key>CFBundleIdentifier</key>
    <string>com.yourcompany.MyCoffeeApp</string>
    

    确保节点无拼写错误,字符串值不为空。

  • 直接在项目文件中配置ApplicationId
    右键iOS项目选择"卸载项目",再右键项目文件(.csproj)选择"编辑",在<PropertyGroup>节点中添加:

    <ApplicationId>com.yourcompany.MyCoffeeApp</ApplicationId>
    

    保存后重新加载项目,该配置会覆盖Info.plist中的对应字段,同时能让Xamarin构建工具正确识别。

  • 清理重建项目
    按以下步骤操作:

    1. 执行菜单→"生成"→"清理解决方案"
    2. 删除iOS项目下的bin和obj文件夹
    3. 重启开发工具(Visual Studio for Mac/Windows)
    4. 重新构建并运行项目
  • 检查构建配置对应的Info.plist路径
    有些项目会为Debug/Release等不同配置指定不同的Info.plist文件,检查项目属性→"iOS应用程序"→"Info.plist"路径是否指向你配置了CFBundleIdentifier的文件。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.23 14:36:20