I have several Text Field items in the Root.plist of my Settings.bundle. I need all of them for my app, but I want one of them to be either hidden or un-editable by the user. E.g. When the user goes on his iPhone to Settings-->MyApp, I want one of the fields to not be visible there, or disabled for editing. Is this possible?
Sure you can. Just change the item type to title.
You still can save and read it's value from code. but, it will not appear in the app. settings.
After further research I have found the answer to my question, and the answer to the problem I am trying to solve.
Question: Can you hide/disable fields in Settings.bundle/Root.plist?
Answer: No.
Problem: How do I securely store authentication information for my app?
Answer: Built in Keychain services.
Source: Keychain Services Tasks for iOS
Setting the type in the plist from "Text Field" to "Title" works in that you get a field that is no longer editable by the user but can be read by the app.
It doesn't look quite right in as far as UI consistency goes, so this may not be the ideal solution to disable a preferences item.
Short answer, you can't. Long answer: I presume you are using the Root.plist somewhere else inside your app, is that right? If so, what I'd recommend in this case, if you really need it to work the way you described, is to create two plist files, and merge them at runtime.
In other words, create Root.plist with only the fields you want the user to change in the iOS settings page (e.g, without the field you are currently trying to hide), and another .plist file with the rest of the fields you want to handle inside your app.
Then, at runtime, you first load Root.plist, and then merge the contents of the another .plist file in the data structure you'll be using.
Not very slick, but could possible work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With