My app wants to recognize whether or not the user has gone into guided access mode.
I currently have a NSNotification setup which triggers a boolean provided by apple but for some reason it is always providing a false negative.
NSNotificationCenter.defaultCenter() .addObserver(self, selector: #selector(guidedAccessChanged), name: UIAccessibilityGuidedAccessStatusDidChangeNotification, object: nil)
will trigger the following method
func guidedAccessChanged () {
// NSLog(@"Accessabilitiy enabled: %@", UIAccessibilityIsGuidedAccessEnabled() ? @"YES" : @"NO");
print("Accessabilitiy enabled: \(UIAccessibilityIsGuidedAccessEnabled() ? "YES" : "NO" )")
if (!UIAccessibilityIsGuidedAccessEnabled()){
print("guided access Off")
}
else{
print("guided access On")
}
}
But for some reason the logs are returning
guided access Off