2

I have a main app with a bundled helper app within. The helper app is a necessity for the main app to function correctly. As of right now, I have the main app launch the helper app on launch, and have the main app send a notification telling the helper app to terminated through the NSDistributedNotificationCenter on the termination of the main app.

This way works most of the time. However, if the main app is force closed, the helper app remains running (no notification is sent. I am using the AppDelegate's applicationWillTerminate method to send the notification).

Is there a way to make the running of the helper app more reliable? Also, is there a better way to make the communication between the two apps (ie not NSDistributedNotificationCenter; is there away to communicate through app bundles?)?

Thanks!

1 Answer 1

2

You could always use a common approach of 'pinging' each other to indicate the app is still alive (also via notifications) like once a minute.

No notification received after some timeout being the helper app's trigger to shut itself down.

Not super-elegant but pragmatic and proven.

Or check the list of processes for the other app still being alive, though the latter sounds more brittle to me.

1
  • Thanks for your response!
    – Matthew S.
    Commented Jan 26, 2016 at 17:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.