iPhone Settings.bundle - how to disable/enable a setting based on other settings? - iphone

Hard to explain, but luckily there's an example. On an iPhone, when you go to Settings > Nike + iPod, in the app's settings, when you set Nike+iPod to off, it disables the rest of the settings. How do I do that? Use one setting to disable or toggle off another setting?

For AppStore apps, no you can't do that, period.
Detail: Nike+iPod is using a different mechanism known as "Preferences Bundle", which allows more kinds of specifiers (e.g. buttons) and running code. To disable settings live, one need codes. "Settings Bundle" which AppStore allows cannot run code. So that cannot be done.

Related

Set default app as ON in Active Screen ios xcode

Now i am using swift to code my app. I used share extentions and it runs well.
But I have a problem.
app set default value in active screen as OFF. I want to set default as ON. Do you have any solution?
Thank you
By default, share extensions are turned off until the user manually enables them with the More... menu. That's just how iOS works and there is nothing you can do about it, other than instruct your user to open the share dialog and hit More to enable your app.
Only apps like Vimeo which have an agreement with Apple can default to visible in the share menu.
Source + more information.

programmatically READ iPhone settings

I want to programmatically READ iPhone settings such as...
Enable 3G - YES/NO
Vibrate - ON/OFF
Message Alert - ON/OFF
etc.
Can anyone provide a solution?
I'm fairly certain you cannot: see Opening the Settings app from another app
You cannot. Because apple is not providing the API to access the iPhone settings app. But you can keep a bundle setting in your app so that user can change the settings of your app from iphone settings. If you are interested in this feature you can refer Apple doc.

How can you control the logic of an iPhone pre-generated settings (bundle) pane

How can I control the logic of say 5 "automatically generated" on/off switches using a method similar to this http://knol.google.com/k/iphone-sdk-application-preferences?pli=1# when the app isn't running. Some of my settings are contingent on other settings being on or off. IE setting logical gates for this plist's pre-generated settings view. I have this working in my App but I can't have my app having invalid settings because of 5 on/off switches that are independent of each other because the app can't currently control them, when I need some of them linked. So basically I just disable this pane, and the user can only change settings in the app. It would be nice to using the "General" Settings app...
Thanks
The only way to do this would be to validate the current App Settings on startup and notify the user if you discover problems with the settings.

Adding a button to an iPhone prefs / settings bundle?

Just wondering if it's possible to add a button like the "Clear History", "Clear Cookies" etc buttons in the Safari preferences to your own app's settings bundle? Been digging through the dev docs and can't find any plist specifier for a button, so I'm wondering if this is an internal API for the Apple guys?
After you hit the button, you get an action sheet asking you whether you really want to do it, and then presumably there is some callback based on the user's input.
Also noticed that the Nike + iPod settings have a clear button in them, but again, that app might have access to internal APIs that we don't.
No, this is not possible. The system only supports interacting with the values from within your app. You can't run code from the settings app so a button would be useless.
Nike+iPod is a root application. Anything running under root can run code from basically anywhere (with restrictions, Sandbox is a b**ch) If you're interested you can make a jailbreak preferencebundle with Theos or iOSOpenDev! Which allows you to make a root bundle that can run button action code.
iOSOpenDev, which extends Xcode for iOS jailbreak-style project development, provides project templates that have a check boxes to include either a simple PreferenceLoader (plist-based) or a full PreferenceLoader bundle.

Can you put a button in the Preferences for your iPhone app?

I'm building an iphone app, and I wanna use the iPhone's built in Preferences stuff. It looks like I put options in there, but I'm interested in putting a Reset button in the Prefs. I see that Apple's built-in apps like Safari have buttons in their prefs (Clear History, Clear Cookies, etc). I don't see a way to do this for SDK apps. Help!
Your Settings bundle cannot contain any runnable code, so it's not possible to have buttons like safari (Clear History, Clear Cookies, etc).
Safari is a builtin application provided by Apple, therefore it has access to apis/privileges that normal AppStore applications don't.
You can see the list of possible elements here.
One thing you can do, since you can set your own app's preferences during runtime, is create a "Reset preferences on next run" toggle.
When your app starts up, check for this setting and act accordingly if it is set to "On". Don't forget to reset the toggle as well. ;-)
Here's a Q&A that explains how to do this: How to change the app preference settings through code?