在没有 UI 的情况下启动 iOS 扩展程序

Launch iOS extension without UI

我必须在 iOS 应用程序之间共享数据,而无需任何用户交互。

经过一番谷歌搜索后,我发现最好的方法是使用 Extension。根据 Apple 扩展指南,用户通过与某些系统提供的用户界面交互来打开应用程序扩展。例如,用户通过激活应用程序中系统提供的共享按钮并从显示的列表中选择扩展来访问共享扩展。

我的问题是我们可以在没有任何 UI 按钮的情况下访问 share/action/documentProvider 扩展程序吗?我们可以自定义扩展程序的启动方式吗?

是否有其他安全的应用程序间通信方式。

假设共享中涉及的所有应用都是您developed/controlled创建的,实现此目的的最佳方式是shared container。根据文档:

The com.apple.security.application-groups (available in OS X v10.7.5 and v10.8.3 and later) allows multiple apps produced by a single development team to share access to a special group container. This container is intended for content that is not user-facing, such as shared caches or databases.

In addition, this attribute allows the apps within the group to share Mach and POSIX semaphores and to use certain other IPC mechanisms among the group’s members. For additional details and naming conventions, read “Mach IPC and POSIX Semaphores and Shared Memory” in App Sandbox Design Guide.