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

React Native iOS项目CFBundleDisplayName应用名称空格过大求助

React Native iOS 应用名称(CFBundleDisplayName)空格过大问题排查与解决

开发React Native iOS项目时,遇到应用名称显示双倍空格的问题,尝试了以下4种配置方式,模拟器和真机上均未解决:

  • 配置1:
<key>CFBundleDisplayName</key>
<string>App&#x2007;Name</string>
  • 配置2:
<key>CFBundleDisplayName</key>
<string>App Name</string> 
  • 配置3:
<key>CFBundleDisplayName</key>
<string>App&#x0020;Name</string>
  • 配置4:
<key>CFBundleDisplayName</key>
<string>App&#32;Name</string>

可行解决办法:

  1. 用Xcode可视化界面修改:别直接编辑Info.plist的XML代码,打开Xcode项目,找到Info.plist文件,右键选择"Open As" -> "Property List",找到"Bundle display name"字段,直接输入带单个空格的名称,规避XML转义的解析异常。
  2. 替换为窄无间断空格:直接使用U+202F字符(可复制: )替换普通空格,这个字符在iOS系统中显示宽度更窄,且不会被解析为双倍空格。
  3. 彻底清理缓存后重编译:
    • 删除Xcode的Derived Data(路径:~/Library/Developer/Xcode/DerivedData)
    • 重置模拟器:模拟器菜单 -> "Device" -> "Erase All Content and Settings"
    • 执行npm clean或yarn cache clean清理RN缓存,重新编译安装应用。
  4. 检查本地化配置冲突:如果项目做了本地化,查看InfoPlist.strings文件中是否也设置了CFBundleDisplayName,确保这里的名称空格正确,避免和主Info.plist的配置冲突。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 12:22:35