Sunday, December 13, 2015

programmatically implement Single-App Mode in IOS 7 and above

Hi All,

Recently i had to work on a app where the requirement is to lock the device(iOS) to Single-App mode, i.e the device to lock to the app and even when restarted it should boot back to the same app.

I had to use the  UIAccessibilityRequestGuidedAccessSession api
 to make it work. the code is pretty simple as mentioned in the Apple document and SO.

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/index.html#//apple_ref/c/func/UIAccessibilityRequestGuidedAccessSession

as mentioned there pass YES to lock, NO to unlock. The call back method didSucceed actually confirms whether it worked or not.

Here are the things with my app and the steps i performed.


  1. Supervise the iPad/iphone using the Apple Configurator.
  2.  Install the MDM related files ( Each MDM has its own set of instructions, usually involves downloading a profile).
  3. Every MDM has a option of Single APP Mode or MultipleAppMode. Select the second option and add the app IDs to the list. (A single APP mode works pretty well with MDM's but i did not want the app to be locked to a single APP all the time).
  4. As mentioned used the UIAccessibilityRequestGuidedAccessSession to lock at the beginning and unlock at the end.
  5. FYI.. this is a Enterprise App as you must have already noticed but just wanted to mention.

Thanks,
Bob :)