PDA

View Full Version : Write Code that Updates Itself?




ArtOfWarfare
Jun 2, 2013, 02:18 PM
Specifically, I'm writing a plugin that I want to be capable of updating itself. I figure the steps I should follow are:

(Assuming a new version is available)
1 - Download the updated version.
2 - Move the current version bundle to the trash.
3 - Move the updated version bundle to where the current version bundle was.
4 - Launch/load the updated version.
5 - Terminate/unload the current version.

What seems like it could be a snag in my plan is here:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingCode/Tasks/NameConflicts.html

Every exported symbol in a plug-in must be prefixed with an identifier unique to the plug-in. This requirement is not circumvented by unloading each plug-in before loading the next one. Once an Objective-C symbol (class names, protocols and categories) gets loaded, it cannot be unloaded.

So... is it not possible for me to update the plugin without restarting the entire app? I'd rather not annoy the user with the update process or place a burden on them having to manually do it...

Does anyone have experience with writing self-updating applications or plug-ins?



truehybridx
Jun 2, 2013, 06:26 PM
Specifically, I'm writing a plugin that I want to be capable of updating itself. I figure the steps I should follow are:

(Assuming a new version is available)
1 - Download the updated version.
2 - Move the current version bundle to the trash.
3 - Move the updated version bundle to where the current version bundle was.
4 - Launch/load the updated version.
5 - Terminate/unload the current version.

What seems like it could be a snag in my plan is here:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingCode/Tasks/NameConflicts.html

So... is it not possible for me to update the plugin without restarting the entire app? I'd rather not annoy the user with the update process or place a burden on them having to manually do it...

Does anyone have experience with writing self-updating applications or plug-ins?

Isnt that what the Sparkle.framework does? it auto updates the app, or did you want some thing more?

ArtOfWarfare
Jun 2, 2013, 06:31 PM
Isnt that what the Sparkle.framework does? it auto updates the app, or did you want some thing more?

Hmm... It does say that it supports plugins. I guess I can try it out.