I'm working on an Objective-C Cocoa app in Xcode for OSX which will be distributed outside the App Store.
One of the menu items in the app is "Check for Updates". The user can click this item and check if there's an update available.
If there is an update available, the update will be downloaded.
My question is : What is the common approach for updating an app? Since the app is open, it can't overwrite itself. So how is this typically done?
Do you separate your app into a launcher and the app itself? If so, I imagine that when the user starts the app, it is in fact the launcher that's started. The launcher then checks to see if an update has been downloaded and it replaces the old app binary with the new app binary. Is that how it's done on OSX or is there a smarter way?
Sparkle is really good, however if you prefer in-house solution then here is one possible approach.
Steps:
Where the real "magic" happens is when old app is done with the download and unpack. Then old app from it's bundle copies to a temp location it's relauncher (simple terminal app) and launches it with the following command line args:
When all is done, after launching the relauncher old app terminates. At this point relauncher is already running and waits for old app's termination.
When old app terminates then relauncher does three things:
Update is done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With