Adding a button to an iPhone prefs / settings bundle? - iphone

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.

Related

iPhone - Change icon of the app programmatically at runtime

I can read that changing the app icon programmatically at runtime is not possible, at least since iOS 3.0.
But... I regulary can see on "App" websites apps that can put icons on the springboard. The first I remember is that kind of app that you give a friend's picture from your album, and it creates an icon so you can call him just clicking on that icon:
http://itunes.apple.com/fr/app/speedtouch-the-best-home-screen/id378360978?mt=8
http://itunes.apple.com/fr/app/desktop-shortcut/id421701004?mt=8
http://itunes.apple.com/fr/app/appbutler-app-organizer/id327391626?mt=8
http://itunes.apple.com/fr/app/tap4music/id365578914?mt=8
So I guess, is it still impossible to change the app icon programmatically at runtime?
Update
Apple have changed this, you can do this now: https://developer.apple.com/documentation/uikit/uiapplication/2806818-setalternateiconname
Original Answer
What you're thinking of here are WebClips, which are basically shortcuts to websites on the home screen. An actual application cannot change it's icon at runtime, as it's defined in the static Info.plist file.
The only exception to this rule is Newsstand applications.
This is now possible in iOS 10.3 using the UIApplication.setAlternateIconName(_:completionHandler:) API.
See my answer to this question: https://stackoverflow.com/a/44966454/233602
Changing your actual icon (other than, e.g, badging) would require changing the app bundle. I'm pretty sure that you don't have write access to the bundle, and in any event this should change the code signature, causing the OS to prevent launching.
So, no. Apps can put links to web sites, but not change their own app.

Can I disable Home Button on my App? (full screen browser kiosk mode)

I have to put a lot of iPads on a stantd on a tourist fair to show our web, and we don't want that people can use these iPads to play/enter facebook/etc. Is for this that I was searching an application that put the iPad on kiosk mode to show fullscreen our web, but that's ridiculous if the user can press home button an go to springboard...
Is for this that I start to develop a fullscreen browser without address bar, only show a URL that is selected programatically, and I think to deploy this app on our iPads (we have a developer account), but we have the same problem: if the user press home button, he can select Safari and enter to any website.
In conclusion, we need to disable home button to hold the user on our website (I know that if press and hold home button + power button, iPad reboot, but the power button will be disable physically on the stand), and I also know that this app will not be approved by Apple, but as I said before, this app will be only to the fair stand.
Thanks.
Four years after, I found the response.
No, you cannot disable the home button. (And thank Apple for that. Who knows how many people would believe that their app is so fantastic that people ought not stop using it ever.)
Why do you need to disable the home button anyway? Why not build a stand for the iPad that blocks access to the home button?
Could you not use the parental controls to restrict/prevent access to Safari, Mail app's etc?
On iPad,
Settings > General > Restrictions
You can then easily remove app's such as Safari from the ipad's springboard, and to enable access requires a code (which you set) so no one would be able to access default app's that you don't want them to :)
Of course people would still be able to exit your app by pressing the home button, although they would not be able to do anything, and you can even stop them from deleting apps through the restrictions settings.
The only way to prevent exiting via the home button would be to physical stop people from pressing it by having the stand cover it over.
There are companies that make specific products for this type of thing. Here is a write up a couple (they are not cheap)...
http://www.tuaw.com/2010/04/26/ibracket-turns-your-ipad-into-an-ikiosk/
Steven
Probably too late for the OP but for anyone else trying to do this then see my answer here Lock-down iPhone/iPod/iPad so it can only run one app
I had been trying to do the same use case and pretty much everyone on stack overflow is saying it's not possible. Turns out that it is.
More than 4 years after, I found the answer, haha.
I'm not sure since when, but now we can block to use only one app from Settings > General > Accessibility > Guided Access
After that, we can do triple tap with our app opened, and it will be locked.
Also, we can use Apple Configurator to "Lock to App", but this way required to install a profile in the iPads (it wouldn't be a problem four years ago...).
It is possible. But I think Apple may reject your app. I found a link with good explanation here
And this might help also.
http://www.akadia.com/services/ssh_test_certificate.html
http://www.verisign.com/support/verisign-intermediate-ca/code-signing-intermediate/index.html
Blocking home button access is desirable where these units are used commercially as promotional displays or in point of sale environments. It would be useful, actually, if Apple licensed developers of point of sale apps to be able to do this - it would be no problem for this function to be specific to registered ipad units....and it would also make the ipad less of a theft target. it would be useless to anyone but the owner. right now the only answer is to physically cover the button in an enclosure, thus concealing Apple's investment in a beautiful product design.
Achieveable in software like so:
Settings > General > Accessibility > Guided Access
Set a pin if your iOS device has public access.
once in the app you want to lock down, triple click the home button to enable guided access. With this on users will be restricted to your app (or webclip) and required to enter the pin to exit to iOS home if they hit the home button.
There is no solution for this issue, maybe if you jailbreak your device, there is one, but I don't think so.
Please see: Temporarily Lock or Disable iphone home button
Why do you need to block the button? If it's some kind of evil plot to make developers only use the device for developing, the home button IS important: you must test what happens when the real user do that.

Hide Settings Bundle in Settings.app

I have created an iOS 4.0 app with a Settings bundle. I am using the InAppSettingsKit (http://www.inappsettingskit.com) which presents the settings in the app. This allows the user to modify those settings directly from within the app, without the need to go to the external iPhone Settings.app. As the settings are accessible from inside the app (and I am doing some custom styling to the in-app settings screen) I would like to stop the Settings bundle from appearing in the iPhone Settings.app. Is this possible?
Any help would be greatly appreciated.
InAppSettingKit allows the use of an internal only settings bundle. Rename Settings.bundle to be this and then the OS wont find it to put it in the Main Settings part
Check out "Some little extras" on the product page

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?

How do I make iPhone SpringBoard show two or more icons for one application bundle?

It seems like Info.plist file has an ability to declare different roles for the same application bundle through the UIRoleInfo key. SpringBoard can recognize these roles after installing an app and may display separate icons for each application role.
For instance, iPhone shows MobileSlideShow.app as 2 different programs: Photos and Camera.
Unfortunately, there is no official Apple documentation about the subject at the moment. Would anybody advise how to organize the same behavior in a custom app?
This feature is going to be used in the Enterprise product for ad hoc distribution.
This isn't a supported feature, so if you do this you might have a hard time getting your app through the approval process. I wouldn't recommend using it.
Have you tried it to see if it works? If it doesn't work, you could create a second app that does nothing but launch the first one, with a custom URL scheme. The first app can recognize when it is being launched with that URL. This is not ideal as you will see the second app launch & quit (though it should be really fast).