Prior to iOS 8.3, the way to check whether "Allow Full Access" was granted to a keyboard extension was through the following code in the container app:
- (BOOL)isOpenAccessGranted{
return [UIPasteboard generalPasteboard];
}
However, as comments on this popular SO answer thread point out, since iOS 8.3, an app can read from shared group containers even if full access is not granted, so the above code always returns true. However, write permission is granted only if "Allow Full Access" is turned on.
I have tried listing out all of the pasteboards based on Apple's docs on UIPasteboard
, but it does not delineate which ones are accessible. Any insights on this is much appreciated.
Here's my currently working / deployed implementation:
- (void)viewDidAppear:(BOOL)animated {
NSLog(@"keyboard has full access? %@", ([self validateKeyboardHasFullAccess] ? @"YES" : @"NO"));
}
- (BOOL)validateKeyboardHasFullAccess {
return !![UIPasteboard generalPasteboard];
}
On iOS 8.4 the UIPasteboard.generalPasteboard()
is nil
if Full Access is not allowed.
Try removing keyboard and container app + clean and build
app, before testing again. Should work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With