自定义键盘扩展可以在运行时与配套应用程序通信吗? [英] Can a custom keyboard extension communicate with the companion app at runtime?

查看:184
本文介绍了自定义键盘扩展可以在运行时与配套应用程序通信吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自定义键盘可以在运行时与配套应用进行通信吗?自定义键盘可以根据随播应用中设置的状态动态显示内容吗?

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?

如果是这样,扩展程序和应用程序之间的通信可用哪些API /文档?

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

推荐答案

以下文档中的一个很好的段落可以帮助您开始与您的配套应用程序共享数据: https://developer.apple.com/library/prerelease/ios/documentation/一般/概念/可扩展性PG / ExtensionScenarios.html#// apple_ref / doc / uid / TP40014214-CH21-SW6

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

我使用今天的扩展和伴侣应用程序。它们共享相同的NSUserDefaults,因此它们可以相互实时通信。如果您正在寻找NSUserDefaults,这里有一个很好的教程: http://www.glimsoft.com/06/28/ios-8-today-extension-tutorial/

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/

这篇关于自定义键盘扩展可以在运行时与配套应用程序通信吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆