Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I Hide/Disable fields in Settings.bundle?

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?

like image 573
Groppe Avatar asked Nov 29 '11 16:11

Groppe


4 Answers

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.

like image 74
hasan Avatar answered Oct 12 '22 23:10

hasan


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

like image 45
Groppe Avatar answered Oct 13 '22 01:10

Groppe


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.

like image 42
Carl Russmann Avatar answered Oct 13 '22 00:10

Carl Russmann


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.

like image 26
Rafael Steil Avatar answered Oct 13 '22 01:10

Rafael Steil