I'm trying to add an additional iPhone Settings File type to my Settings.Bundle and reference it in my Root.plist as a Child Pane type, but it isn't working. I've followed the documentation from Apple here, but it will not keep the plist file as an "iPhone Settings" type. I'm assuming that is why I can't drag it to my Settings.Bundle file either.
Basically, add a new plist by selecting File > Add New File...; select Resources under iOS, and then select plist type.
Now add some plist properties to the file.
Now right-click and choose "Property List Type" and select "iPhone Settings." You'll notice the keys in the file change. That's good. Save.
Now, click on another file to view that file and click back to the new settings file. Did it change back to the old property names and property type? It does for me, so it's staying as an iPhone Settings file type, and thus isn't working.
Anyone else have this problem? I'm wondering if it is an Xcode thing, or if it's a project preference/option/setting that I need to change.
One obvious thing that caused me to waste some time: kill the settings app after making changes.
It still doesn't save the settings type, but I got it working by copying the plist file into bundle from the command line. You can also right-click the "Settings.bundle" file and select "Show Package Contents" and copy the file in Finder.
Related
I'm having a hard time integrating InAppSettingsKit. First of all, XCode isn't recognizing that the settings.bundle I've added to my project actually contains files. So I have to open that bundle through the Finder to get at the root.plist file.
When i open it, the preference items are restricted to the basic types such as Group, Title, etc and if I try to use something provided by IASK such as PSGroupIdentifier, it immediately reverts to Group.
What am I missing here? What tells the plist file what types are allowable?
First, to see the contents of Settings.bundle, click on it, and in the right pane (the inspector), set File Type to "Application Bundle".
As for Root.plist, these are items that are being used specifically in the Settings app, and as such are limited to a fixed number of options. When you view it from inside XCode, you will see that when you create a new entry, there are only certain entries you can create.
Has anyone been able to to add a second preferences pane to an ios application? I went through the steps, however, the second page I add doesn't keep its settings.
I don't know what I need to add to this question to help clarify.
I changed the "type" of the second .plist to "iPhone Settings plist"; The root item is set correctly to "Preference Items". When I navigate away from the new .plist the type reverts back to "PreferenceSpecifiers".
Having the same troubles, resolved by :
right clicking in the plist editor and checking "Show Raw Keys/Values"
changing / checking values in raw mode.
Hope that help.
Excerpt from Implementing Application Preferences:
In the Detail view, select the Root key of the Root.plist file.
Choose View > Property List Type > iPhone Settings plist.
This command formats the contents of the property list inside the Detail view. Instead of showing the property list key names and values, Xcode substitutes human-readable strings ... to make it easier for you to understand and edit the file’s contents.
(In Xcode 4.2, right-click the Root key and select Property List Type > iPhone Settings plist.)
You can also try editing the XML directly by right-clicking the file and selecting Open As > Source Code.
Finally, make sure you save the plist after making your changes and before navigating away.
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.
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.
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.
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.
Any help GREATLY appreciated!!
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.
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.
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.
I was not able to get the text field to show up under additional .plist page.
My Fix:
Leave only 1 Child.plist file outside Settings.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
In 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 the Preference Items, then expand it and modify the value of Type to Child Pane.I can't upload the image, so give the link of the blog.
This problem still exists in Xcode 4.2. Creating and moving [child].plist in Finder does help thanks to John S up there.
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.
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).
Same issue, waste my almost 1 hour.
1st make sure your plist format is correct.
My solution:
Delete you bundle, and re-build & run.
Now everything is fine...
I have a project with two Info.plist files (one for each target). In the second Info.plist, when I add a field it shows the internal name instead of the English name. For example UISupportedInterfaceOrientations instead of "Supported Interface Orientations".
Also, when I click on the dropdown list to see all options, some of the options that are available in the first .plist file are not in the second (eg CFBundleIconFiles). The two problems are really the same thing (anything which shows the internal name does not appear in the dropdown).
The Bundle Verion is 1.1 in both files, the CFBundleInfoDictionaryVersion are both the same, as are the plist version and the DTD.
What's stopping the second plist from giving me these options? Thanks.
alt text http://img.skitch.com/20100708-ctia2e6yfwgd7twdnepryidayr.jpg
Xcode has a couple of different editors to show the contents of plist files. One of them is the generic plist editor, which shows the names of the keys without translation. The plist editor can also be in the specialized Info.plist mode, where it knows about the structure of this special type of plist file and translates keys to english.
I don't know how Xcode decides which editor to use, so the following is just guessing: I assume Xcode looks into the selected target to check the path to the Info.plist file and if it is the edited file, uses the specialized editor. So if you have one target selected, but open the other targets Info.plist it might use the generic editor instead.
Xcode also manages file types for each file in the project. You can override Xcode's automatic guesses by opening the file's settings (click on the file in the outline view and press command-I). Maybe there's a file type to identify Info.plist files.
As a last resort, you can always open the file by right clicking it in the outline view. In the context menu from "Open as ..." you can choose how to open it. I usually use "Source Code File" since I like to see the original XML.
Typically, there are times when not all options are shown. If you know it is supposed to exist, you can just add the key (via copy/paste) from the XML file of the other info.plist. I normally just open it up as XML and work in that mode (which gives non-English names).
All keys can be found here: http://developer.apple.com/iphone/library/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html
In the latest XCode, it has been converting everything automatically to English names for me though even when I try to paste as a non-English name in the property list editor.
Short Answer
Select iPhone Info.plist from the View > Property List Type menu.
Explanation
This actually has nothing to do with the plist file itself. It's how Xcode (via the Property List Editor) presents the file.
You can test this by, in Finder, making a copy of a correctly-displaying plist file. Open the copy in the Property List Editor (usually the default application). The copy usually won't display the English names (until you change the Property List Type).
Xcode will remember the type you select and save it in the .xcodeproj file.
I have a settings bundle in an iPhone app which has several subtle variant targets.
The problem is I need to customise some strings in each settings bundle to make them appropriate for each target. It appears that if the Settings bundle is named anything other than Settings.bundle it won't pick up the bundle (understandable, can I specify in a plist somewhere the alternate name?).
If I try and put them in different folders and call them the same thing Xcode gets horribly confused and lets you edit "2 files" that are actually the same single source.
I see no problem. For every target, create a specific folder with files for this target. Now create a group in Xcode for every of those folders and drag each of the new Settings.bundle directories to the corresponding group. When adding the bundles to the project, make sure that every bundle is only built (included) for its target by checking the appropriate box.
AFter you do what MrMage said which is correct.. i had an issue where the Root.plist would not show up under the Settings.Bundle for a specific target.
You have to let xcode know what the setting.bundle file is... click on the settings.bundle that wont show the Root.plist, then go to file inspector
Alter the file Type drop down to be applicationBundle ... now the Root.plist shows up.