Reputation: 5515
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.
Upvotes: 34
Views: 1832
Reputation: 463
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.
Upvotes: 1
Reputation: 1893
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];
}
Upvotes: 2