Recently, I have faced the same situation. There seems to be no way to enable or run managed access from object code c. However, you can check with the help in object c whether managed access is enabled or not UIAccessibilityIsGuidedAccessEnabled ()
It returns YES if managed access is enabled. Thus, you can only allow the user to give a test when managed access is enabled.
If you want to know when managed access is enabled or disabled, you need to configure something like this:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(guidedAccessChanged) name:UIAccessibilityGuidedAccessStatusDidChangeNotification object:nil];
You can read more about this here:
UIAccessibilityIsGuidedAccessEnabled
UIAccessibilityGuidedAccessStatusDidChangeNotification
source share