I would like to use inter-process communication in my app extension to notify its containing app when the extension makes changes to the app group's UserDefaults
database. Currently, there appears to be no way to be informed when the UserDefaults
database is updated by a different process, so I assume I'd have to establish IPC between the extension and the containing app. According to Apple's documentation, this seems to be possible using multiple different approaches:
Apps within a group can communicate with other members in the group using IPC mechanisms including Mach IPC, POSIX semaphores and shared memory, and UNIX domain sockets. In macOS, use app groups to enable IPC communication between two sandboxed apps, or between a sandboxed app and a non-sandboxed app.
I've done some research and it seems that most of these techniques are request-driven instead of asynchronous. Is there a good way to use these techniques such that my extension can notify my app when it has changed the app group's UserDefaults
?
Additional information:
- The extension I'm building is a Broadcast Upload Extension.
UserDefaults.didChangeNotification
does not work across processes, so it doesn't work for this purpose.- A solution in Swift would be ideal, but Objective-C is fine too.