How should Finder Sync Extension and Main App communicate?

前端 未结 2 1521
萌比男神i
萌比男神i 2020-12-09 07:14

My use case: I have a \'MainApp\' which does the syncing of files. I would like that \'MainApp\' handles all server calls regarding syncing and other REST API calls such as

2条回答
  •  遥遥无期
    2020-12-09 07:18

    Apple documentation about sandboxed Mach Inter-Process Communication:

    https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW24

    IPC and POSIX Semaphores and Shared Memory

    Normally, sandboxed apps cannot use Mach IPC, POSIX semaphores and shared memory, or UNIX domain sockets (usefully). However, by specifying an entitlement that requests membership in an application group, an app can use these technologies to communicate with other members of that application group.

    Any semaphore or Mach port that you wish to access within a sandboxed app must be named according to a special convention:

    • POSIX semaphores and shared memory names must begin with the application group identifier, followed by a slash (/), followed by a name of your choosing. Mach port names must begin with the application group identifier, followed by a period (.), followed by a name of your choosing.

    • For example, if your application group’s name is Z123456789.com.example.app-group, you might create two semaphores named Z123456789.myappgroup/rdyllwflg and Z123456789.myappgroup/bluwhtflg. You might create a Mach port named Z123456789.com.example.app-group.Port_of_Kobe.

    Note: The maximum length of a POSIX semaphore name is only 31 bytes, so if you need to use POSIX semaphores, you should keep your app group names short.

提交回复
热议问题