新创建的plist文件显示Root而非Information property list,无法添加子项求助
解决Info.plist显示Root且无法添加子项的问题
问题根源
你创建的是空白属性列表文件,而非Xcode自带的Info.plist模板文件,所以缺少预设的根节点命名和可扩展结构。
修复方案
方案1:替换为标准Info.plist模板
- 删除当前显示“Root”的plist文件
- 在Xcode右键项目目录 → 选择「New File」
- 搜索并选中「Property List」,点击「Next」
- 文件名必须设为
Info.plist,点击「Create」注:Xcode会自动给这个模板生成「Information property list」根节点,以及常用的默认配置条目,直接就能添加子项
方案2:手动修复现有plist(无需删除)
- 右键你的plist文件 → 选择「Open As」→ 「Source Code」
- 替换所有内容为以下标准模板代码:
<?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>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>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleVersion</key> <string>1</string> <key>LSRequiresIPhoneOS</key> <true/> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> <key>UISceneStoryboardFile</key> <string>Main</string> </dict> </array> </dict> </dict> <key>UILaunchScreen</key> <dict> <key>UILaunchScreenName</key> <string>LaunchScreen</string> </dict> <key>UIRequiredDeviceCapabilities</key> <array> <string>armv7</string> </array> <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> </dict> </plist>
- 保存后,右键文件 → 选择「Open As」→ 「Property List」,此时根节点会显示为「Information property list」,可以正常添加子项
后续添加自定义字体
按照Apple教程继续操作:
- 点击根节点旁的
+号,添加新条目 - 键名设为
Fonts provided by application(或直接输入UIAppFonts) - 展开该条目,点击
+号添加子项,填入你的自定义字体完整文件名(如CustomFont-Regular.ttf)
内容的提问来源于stack exchange,提问作者RoaringRook
相关产品推荐
相关产品推荐

