Search code examples
objective-cmacoscocoansuserdefaultssandbox

Reading NSUserDefaults from helper app in the sandbox


I found some resources on reading the NSUserDefaults of another application.

Objective-C NSUserDefaults caching prevents another app from accurately reading changes

NSUserDefaults: Is it possible to get userDefaults from another app?

Apparently, it's not possible. However the questions firstly relate to iOS, and secondly the two apps are completely different.

I have a LaunchAtLogin helper app. But it does some other tasks too. Therefore, the helper app should run always, but only start the main app if the BOOL in the NSUserDefaults is set.

Is there a way I can achieve that?


Solution

  • Since 10.7.4 you can use Application Groups within the sandbox. All applications within the group share the same sandbox. See Application Groups on how to set these up.