Can a custom keyboard extension communicate with t

2019-09-23 02:44发布

问题:

Can a custom keyboard communicate with the companion app at runtime? Can a custom keyboard dynamically display content based on states set in the companion app?

If so, what API’s/documentation is available for this communication between the extension and app?

回答1:

Here is a nice paragraph from the documentation that could get you started in sharing data with your companion app: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW6

I have this working with a today extension and the companion app. They both share the same NSUserDefaults so they can communicate in real time each other. If NSUserDefaults is what you're looking for, here there is a nice tutorial: http://www.glimsoft.com/06/28/ios-8-today-extension-tutorial/