4

I'd like to use a private/hidden iOS method, for example clearIdleTimer from the SpringBoard class (example here). How do I do this? A lot of information references much older iOS versions.

This is just for experimentation, I recognize that private API's are not App Store approved. Also, my iOS device is registered for development but not jailbroken.

Edit: I found these iOS-Runtime-Headers but the samples are not working for me.

Community
  • 1
  • 1
user924037
  • 141
  • 1
  • 6
  • 1
    google for any documentation you can, but in general you'll have to do a *lot* of experimenting... – Michael Dautermann Jan 15 '14 at 19:44
  • Also, it's good to specify *which* iOS version you are targeting, if the docs you found are too old for you. iOS 7? iOS 6+? – Nate Jan 16 '14 at 23:28

1 Answers1

6

Not all private APIs are the same.

Some of them you can use in any app ... you just won't get them approved for the App Store.

Some of them you can use, but only if your app runs with root privileges, which requires a jailbroken phone (plus other steps).

Some of them you can use, but you need to grant your app an entitlement, which I believe also requires a jailbroken phone.

In the case of this API:

@interface SpringBoard <UIApplicationDelegate, SBWiFiManagerDelegate>
{
}
- (void)clearIdleTimer;

You are trying to directly invoke a method in the SpringBoard application. You normally can't directly invoke other apps' methods.

One way you can do this is to use Mobile Substrate (now called Cydia Substrate). This is a powerful code injection platform that would allow you to hook into the SpringBoard application, and use clearIdleTimer. But, using Mobile/Cydia substrate requires jailbreaking your phone.

Some SpringBoard-type features are designed to be invoked by other apps, and those live in SpringBoardServices, which is different from the SpringBoard application. You can try searching SpringBoardServices for equivalent functionality. Those APIs are private, but might not require jailbreaking (I can't recall ... my phone is jailbroken so I don't have to worry about it).

Not the answer you wanted, I suspect :(

Community
  • 1
  • 1
Nate
  • 31,017
  • 13
  • 83
  • 207
  • Not the answer I wanted, but informative. Do you know a list of private but non-root accessible APIs? – user924037 Jan 17 '14 at 20:36
  • There is no such list, no. – Nate Jan 17 '14 at 21:18
  • 2
    @user924037, you should remeber one simple rule - without jailbreak you can only access private APIs from public and private frameworks i.e. everything you can actually link to your app. APIs defined in various apps like SpringBoard or MobilePhone can't be accessed without using something like mobile substrate and thus jailbreak. This way you can norrow the list of APIs you should check. This doesn't mean you can use everything you'll find in frameworks. It's just you can at least call these APIs and check whether they are working. – creker Jan 18 '14 at 23:32