Search code examples
iosuidocumentinteractionios-extensions

Launch iOS extension without UI


I have to share data between iOS Apps without any user interaction.

After some googling, I found that the best possible way for doing that is by using Extension. As per Apple extension guide, users open app extension by interacting with some system-provided user interface. For example, a user accesses a Share extension by activating the system-provided Share button in an app and choosing the extension from the list that’s displayed.

My question is can we access share/action/documentProvider extension without any UI button. Can we customize the way extensions are launched.

Is there any other secured way for inter-app communication.


Solution

  • Assuming that all of the apps involved in the sharing are developed/controlled by you, the best way to accomplish this would be a shared container. Per the docs:

    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.