How can I programmatically enable Guided Access (Kiosk mode) on an iPhone?
You can enter and exit guided access mode from within your app. However, to do so the device has to be supervised, and have an MDM profile installed that has the app's bundle ID in the list of applications that can request guided access mode (the key is autonomousSingleAppModePermittedAppIDs
.
Once that is done, to enter guided access you do this:
UIAccessibility.requestGuidedAccessSession(true){
success in
print("Request guided access success \(success)")
}
Check if kiosk mode is enable ( Guided access)
I add on didFinishLaunchingWithOptions
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(guidedAccessStatusChanged) name:UIAccessibilityGuidedAccessStatusDidChangeNotification object:nil];
-(void) guidedAccessStatusChanged {
if (UIAccessibilityIsGuidedAccessEnabled()) {
[Connexion consumeCallBackCompoTrainEnableAccess : @"true"];
} else {
[Connexion consumeCallBackConduiteEnableAccess : @"false"];
}
}
+ (void) consumeCallBackConduiteEnableAccess : (NSString *) hasAcess {
if(callbackStockConduite != nil && callbackStockConsommedConduite == false && [hasAcess isEqualToString:@"false"]){
callbackStockConsommedConduite = true;
callbackStockConduite(@[hasAcess]);
}
}
This callbackStockConduite is used by reactnative
How can I programmatically disable iphone home button in swift 4?
For kids, there is a feature in the iPhone setting called "Guided Access" this setting lock the phone with one app. This could be helpful for you. You can mention this in your app.
You can use this API to do programmatically. It was introduced in WWDC 2017. For more information how to use API and lock in a specific way. Please check this video. For doing programmatically without any device management it has been explained at 15:40th minute.
Related Topics
How to Mask a Square Image into an Image with Round Corners in iOS
Dismissmodalviewcontrolleranimated Deprecated
Real Time Blur Effect for Navigation Bar
Using Nsuserdefaults with Xcode 8 and iOS 10
Differences Between Udid and Uuid
iPhone App Under Test Crashes After a Few Days
Run Timer in 'Background' When App Is Closed
Rotation Methods Deprecated, Equivalent of 'Didrotatefrominterfaceorientation'
How to Get Rgb Values from Uicolor
iOS Enterprise Distribution Through Ota
iOS 7 Status Bar Collides with Navigationbar
How to Implement Auto-Complete for Address Using Apple Map Kit
How to Make a Button Continually Call a Function When Held Down (Spritekit)
How to Stop Multiple Times Method Calling of Didupdatelocations() in iOS
Uitextfield Securetextentry Bullets with a Custom Font
Trigger Local Notifications Automatically Daily on Dynamic Time Given in Arrays Objective C iOS
How to Get a View's Current Width and Height When Using Autolayout Constraints