xcode 为什么我不能将子窗格 plist 文件添加到我项目的 Settings.bundle 中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6978203/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why can't I add a child pane plist file into my project's Settings.bundle?
提问by Tad Donaghe
I'm running Xcode 4.1 and I've been following a tutorial about app settings. Everything has been going great up until I get ready to add a plist for a child pane that I want to add.
我正在运行 Xcode 4.1,并且一直在关注有关应用程序设置的教程。一切都很顺利,直到我准备好为我想要添加的子窗格添加 plist。
The video tutorial I'm watching (also using Xcode 4.1) shows the guy right-clicking the settings.bundle and choosing Add File... and then saving a file named More. In the video tutorial, he ends up with a More.plist showing up in the project and also in the settings.bundle right in the same level with the Root.plist. I just get it in the project. Nothing in the settings.bundle, and I can't figure out how to copy it there.
我正在观看的视频教程(也使用 Xcode 4.1)显示该人右键单击 settings.bundle 并选择添加文件...然后保存名为 More 的文件。在视频教程中,他最终在项目中以及在与 Root.plist 处于同一级别的 settings.bundle 中显示了一个 More.plist。我只是在项目中得到它。settings.bundle 中没有任何内容,我不知道如何将其复制到那里。
I've also noticed that in the tutorial, in the Project Navigator, the settings.bundle has an icon that looks kind of like an outline of a shield. In my Project Navigator, the settings.bundle looks like a white sheet of paper with a corner folded down.
我还注意到,在教程中的 Project Navigator 中,settings.bundle 有一个图标,看起来有点像盾牌的轮廓。在我的项目导航器中,settings.bundle 看起来像一张白纸,角朝下。
Anyone know what the heck is going on?
有谁知道这是怎么回事?
FWIW, the root app settings works fine in the simulator. I can see the stuff I set up just fine. I can click on the link to my child pane and it switches to it, but nothing that I added in the more.plist shows up there.
FWIW,根应用程序设置在模拟器中运行良好。我可以看到我设置的东西很好。我可以单击指向我的子窗格的链接并切换到它,但是我在 more.plist 中添加的任何内容都没有显示在那里。
Any help GREATLY appreciated!!
非常感谢任何帮助!
回答by John Sonmez
Argh, Apple tends to change things without letting anyone know. The whole settings bundle thing is just not well integrated into XCode if you ask me. If you ever try to localize your application, you will find that you have to manually add the localization folders to the settings.bundle.
啊,苹果倾向于在不让任何人知道的情况下改变事情。如果你问我,整个设置包的事情并没有很好地集成到 XCode 中。如果您曾经尝试本地化您的应用程序,您会发现您必须手动将本地化文件夹添加到 settings.bundle。
Looks like we have to do the same thing to add child menus now, as just adding the plist file does not put it into the settings.bundle.
看起来我们现在必须做同样的事情来添加子菜单,因为只是添加 plist 文件并没有将它放入 settings.bundle 中。
Here is the set of steps I just tried that worked.
这是我刚刚尝试过的一组步骤。
- Open up finder, you can right click or two finger click Settings.bundle and choose "Show in Finder".
- Right click Settings.bundle in the finder window, choose show package contents.
- Copy the new plist file into this the settings.bundle next to the Root.plist
- Delete the new plist from the main project.
- 打开finder,您可以右键单击或两指单击Settings.bundle 并选择“在Finder 中显示”。
- 在查找器窗口中右键单击 Settings.bundle,选择显示包内容。
- 将新的 plist 文件复制到 Root.plist 旁边的 settings.bundle 中
- 从主项目中删除新的 plist。
回答by cranek
I was not able to get the text field to show up under additional .plist page.
My Fix:
我无法让文本字段显示在附加的 .plist 页面下。
我的修复:
- Leave only 1
Child.plist
file outsideSettings.bundle
- Navigate to
Root.plist
- Right click and select 'Show Ray Keys/Values'
- Right click and select 'Add Row'. Add:
- Key: File
- Type: String
- Value: Root
Child.plist
在外面只留下 1 个文件Settings.bundle
- 导航
Root.plist
- 右键单击并选择“显示光线键/值”
- 右键单击并选择“添加行”。添加:
- 关键:文件
- 类型:字符串
- 值:根
回答by SubmarineX
In Xcode 4.3.2,
在 Xcode 4.3.2 中,
- Right click the Project Name in the Project Navigator, and choose
Show in Finder
. - In Finder, right click the setting.bundle and choose
Show Package Contents
. - Copy the new .plist to setting.bundle.
- Back to XCode, open the
setting.bundle
, wilfully add one item under thePreference Items
, then expand it and modify the value ofType
toChild Pane
.I can't upload the image, so give the linkof the blog.
- 在 Project Navigator 中右键单击 Project Name,然后选择
Show in Finder
。 - 在 Finder 中,右键单击 setting.bundle 并选择
Show Package Contents
。 - 将新的 .plist 复制到 setting.bundle。
- 回到XCode,打开
setting.bundle
,在下面任意添加一项Preference Items
,然后展开,修改Type
为Child Pane
。图片上传不了,给个博客链接。
回答by wonster
This problem still exists in Xcode 4.2. Creating and moving [child].plist in Finder does help thanks to John S up there.
这个问题在 Xcode 4.2 中仍然存在。多亏了 John S,在 Finder 中创建和移动 [child].plist 确实有所帮助。
Some additional tips.
一些额外的提示。
Make sure to turn on "Show Raw Keys/Values" by right clicking inside the opened root.plist file for the "ChildPane Type" to appear. Also make sure to select "Property List Type" as "iPhone Settings plist". If you're having trouble with ordering items, just open the plist file in a text editor and move the xml elements around accordingly.
确保通过在打开的 root.plist 文件中右键单击来打开“显示原始键/值”以显示“ChildPane Type”。还要确保选择“属性列表类型”作为“iPhone 设置 plist”。如果您在订购商品时遇到问题,只需在文本编辑器中打开 plist 文件并相应地移动 xml 元素即可。
回答by CSkizzle
Additional additional tip: in Xcode 4.2 to explore/expand the contents of the bundle make sure to set its type to Application Bundle (via File Inspector Menu).
附加提示:在 Xcode 4.2 中,要探索/扩展包的内容,请确保将其类型设置为应用程序包(通过文件检查器菜单)。
回答by dennisFan
Same issue, waste my almost 1 hour. 1st make sure your plist format is correct.
同样的问题,浪费了我将近 1 个小时。1st 确保您的 plist 格式正确。
My solution: Delete you bundle, and re-build & run.
我的解决方案:删除您的捆绑包,然后重新构建并运行。
Now everything is fine...
现在一切都很好...