0
votes

I was looking into making a custom toggle switch option in the iOS settings.app menu to turn a home cooked function on and off. I was wondering if it's possible to do such a thing. If so, how?

1

1 Answers

0
votes

Yes, this is possible, but it works a little differently for jailbreak apps, installed in /Applications, than it does for normal App Store apps.

Take a look at this documentation here. I haven't used it in a while, so if there are things that are out of date, post a comment here, and I'll try to update my answer with code, etc., from one of my working jailbreak apps that does this.

Note that if you want the Settings switch to execute your custom code, rather than just storing a preference value, you'll need to use the PreferenceBundle Approach described in the link above.

You'll also need to make sure the phone has PreferenceLoader, by Dustin Howett, installed on it, for this to work. If you're distributing your app to users (via Cydia, or something like that), you can make sure that PreferenceLoader is automatically installed along with your app. To do this, add this line to your app's DEBIAN/control file:

Depends: preferenceloader

PreferenceLoader is free, has been around for a while, and seems pretty stable, so it's not a bad dependency to have at all. Most jailbreak users will likely already have it.