I'm implementing a custom keyboard for iOS8. I have a containing app that sets a few keyboard specific values to NSUserDefaults so that the keyboard can read from them.
This works fine, however I must set requestsOpenAccess to yes to get this working on device.
This seems like overkill to me, I only want to read a few values from the containing app. I don't want any of the other features of the networked keyboard.
Does any one know if there is a way to read values set in the containing app without requesting open access?
There is no way to share content between host app and keyboard extension without requestOpenAccess.
You have to enabled a shared container for host app and keyboard extension, and use
[[NSUserDefaults alloc] initWithSuiteName:];
to access a shared NSUserDefaults.
Yes it is overkill, but this is the only way.
Related
Is it possible to upload data from custom keyboard to the web service? I mean that an app works on custom keyboard and using it for operations belong to web service like registering user to a website or logging in etc.
Yes, but the user must manually switch on "Allow Full Access" in iOS's Settings app (in the same place where the keyboard is installed in the first place). Your keyboard extension must also request open access by setting the RequestsOpenAccess key to true under NSExtensionAttributes in your extension's info plist.
See more about this option under "Designing for User Trust" on Apple's keyboard extension webpage: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html
I'm developing an iOS keyboard extension, it works well when full access enable at the first time.
But can't load when full access disabled on first time.
Does anyone know why?
I've trusted the provider's profile.
third party keyboard works without full access but it depends on code you have written, for example i have stored data in custom shared container and with ID-s i can retrieve them and re-create as UIImage but if i have no full access enabled then i have issues like this: NSUserDefaults are not saving data to shared app group, cant play sounds (in iOS 9 you can), cant use UIPasteBoard for pasting something.
I am would like to see which app the user is using the custom keyboard when the user starts using it. I am not sure if that information is currently accessible and but so far I was not able to find an answer. I appreciate any help.
I am familiar with the ExtensionPointIdentifier but that's not what I am looking for.
Can I disable custom keyboards (iOS8) for my app?
I have a sqlite database stored in the App Group container in order to register custom shortcut.
I can read/write into it from the app, but not from the keyboard extension.
It seems that the database is in read-only mode from extensions.
I'm using the following code to access it:
let appGroupDirectoryPath = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier(appGroupId)
let dataBaseURL = appGroupDirectoryPath!.URLByAppendingPathComponent("database.sqlite")
Is there a workaround to be able to write into the database from the extension keyboard, or is it completely impossible?
The database is writable from the simulator but not with real devices. I guess it's because permissions are managed differently on MacOS X and iOS.
Figured it out.
For keyboards, there is a property in the Info.plist file called RequestsOpenAccess. You can turn this on to enable write access to the shared container.
However, the end user will have to turn on "full access" in their settings for this keyboard, and they will be prompted with a scary message about how you could be logging their keystrokes.
Here's the Apple article that explains it:
Designing for User Trust for Custom Keyboard
Perhaps it is a silly question but I want to be sure about it.
I am developing an app which uses a pulsometer and I am interested in letting the user set the pulsometer which is going to be used in the app (each pulsometer has an unique ID).
As the pulsometer identifier is something that will be hardlyever changed (but it could be changed) Settings App would be the right place to manage that info.
I know I can use NSUserDefaults in a dictionary way to store values, but I don't want the user manually write the identifier code of the sensor in the Settings App. I want to detect the sensor from the app. I know how do that in my App, but is there any way to do it in the Settings App?
I think it is not possible because it requires including code for executing in the Settings App, but I don't know if it is a way to do it ("linking" the userdefaults with that code or something like that).
For example, the Nike + iPod App lets you detect the sensor in the way I want in the Settings App.
Can anybody confirm that it is not possible (of course, without being Nike and making an agreement with Apple to have the option included in Settings App XD)?
You can set up options for your own app "Settings" pane by using display options based on the pulsometer as soon as you startup your application. Your app would have to detect it when running (and determine the range/steps). After that, the user could change a pulldown/stepper in the settings pane from your app. If I understand you correctly.