Having to require users of Contrast to enable Full Access is dumb, but I didn’t have another choice. Keyboard extenions have the option to use Full Access which opens up the keyboard . Full Access for Contrast was required so users can configure their keyboard layouts, colors, etc. Other than that, it’s really a simple keyboard which should have no reason to need Full Access. It doesn’t need network access, it doesn’t need iCloud, it should not need to access its companion app, and there are no other in app purchases.
There are three options I tried to use with Contrast so the user could configure the keyboard. Below are those options, along with my thought process along the way. Spoiler alert, I chose option 3.
Option 1: Put a Settings View inside the keyboard.
Does not require Full Access
Instead of putting all the settings choices in the companion app (like I did – see option 3) I could have put them in the keyboard itself (somehow). I still think I’d have a separate page that is a UITableView of all the settings choices. I haven’t seen an example of this but I don’t mind the idea for this keyboard. I just thought the experience needed to be thought through more and I knew it’d be a lot more (code/design) work. So I tabled this idea.
Option 2: Settings Bundle doesn’t work.
Does not require Full Access
Taken from App Extension Programming Guide:
To give your users flexibility, create a standard settings bundle, as described in Implementing an iOS Settings Bundle in Preferences and Settings Programming Guide. Your custom settings then appear in the Keyboard area in Settings, associated with your keyboard.
Adding a Settings bundle to the extension wasn’t hard at all. You follow thesame instructions you would for any other app. Except it doesn’t work.Thats right, it turns out the Settings bundle won’t persist changes toNSUserDefaults nor will it post the NSUserDefaultsDidChangeNotificationnotification. I filed a radar://19047870 which was marked duplicate by Apple; so they know about it.
When the Settings Bundle bugs are fixed, I’d like to switch over to it. I can kill the UI in the companion app and not require Full Access. The Settings bundle options are put at the bottom of Keyboard view, but thats okay. I’d prefer it to be Secondary to the selection of the Keyboard.
Option 3: Companion app for configuration
Requires Full Access
I gave up. No more fighting it. Turn on Full Access and just release the damn app. If I do that, then with the App Group and NSUserDefaults would work between the extension and the app. The keyboard can be configured and everyone wins. This required no extra time on my part and just some extra education for the user. So this is the way I went.
Except now I am super bummed. One of my main goals was to ship a keyboard that did not require full access. When Apple fixes their bugs or when I get time to add the settings to the keyboard extension, that’ll be the day Contrast doesn’t require full access anymore.