 |
 |
Cocoa:: Checking Internet For Updates....
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status:
Offline
|
|
So, I found this string of code, but I want to know how it can parse the contents of the URL so that I can include the newer version number as well a description of the new update? (Like my good friend Señor Watson).. I also notice that the two IFs should be switched as well as the define comments becuase you really don't know what version will come out next, right? I am really confused here... becuase, this is a really simplified versioning if you know what you are going to update to next.. but what if i say in the app that 10.2.1 is coming next but i come out with 10.2.3?:
Code:
#define kCurrentVersionIncludeFile @"http://the.url.to/your.txt.file.goes.here"
#define kThisVersion @"0.123b43" //should be the same as the contents of the above file
- (IBAction)checkForUpdate:(id)sender
{
NSString *testVersionString = [NSString stringWithContentsOfURL:
[NSURL URLWithString:kCurrentVersionIncludeFile]];
if ( ![testVersionString isEqualToString:kThisVersion] ) //hopefully our version numbers will never be going down...
//also takes care of going from MyGreatApp 7.5 to SuperMyGreatApp Pro 1.0
{
NSRunInformationalAlertPanel(
@"New Version",
@"A new version of this application is available; would you like to visit the web site?",
@"Visit Web Site",
@"Cancel",
nil);
}
else
{
NSRunInformationalAlertPanel(
@"No Update Available",
@"You already have the latest version of this application.",
@"OK",
nil,
nil);
}
}
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
If you wan't lots of info - perhaps instead of using a text file you could archive an NSDictionary?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status:
Offline
|
|
You shouldn't compare a version number. Check for a date.
i.e.
if ([checkServerForDate] > [dateOfThisVersion])
{
[downloadUpdate];
}
else
{
[displayMessage @"This is the most up-to-date version."]
}
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
Or check out our open-source OmniFoundation framework, which includes a fairly robust utility for automatic version checking. With it, all you need to do is register an object which handles telling the user about the new version -- it does all the work of figuring out which versions supersede other versions, etc. If you're using our OmniAppKit framework as well, it's all set up automatically -- you just need to provide a plist on your web server (and some initial configuration in your app's Info.plist).
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status:
Offline
|
|
Originally posted by Rickster:
Or check out our open-source OmniFoundation framework, which includes a fairly robust utility for automatic version checking. With it, all you need to do is register an object which handles telling the user about the new version -- it does all the work of figuring out which versions supersede other versions, etc. If you're using our OmniAppKit framework as well, it's all set up automatically -- you just need to provide a plist on your web server (and some initial configuration in your app's Info.plist).
oh Señor Rickster, product placement again
How could one include that part without including the whole framework?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status:
Offline
|
|
Tricky, but possible. You'd need to pull out the OFSoftwareUpdateChecker and OFSoftwareUpdateCheckTool classes, and eliminate their dependencies on other Omni code. I don't have the source handy at the moment, so I couldn't tell you whether that's a simple matter of getting rid of stuff like OmniBase assertions or if you'd need a lot. Either way, you're quite welcome to use it as an example.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status:
Offline
|
|
Originally posted by Rickster:
Tricky, but possible. You'd need to pull out the OFSoftwareUpdateChecker and OFSoftwareUpdateCheckTool classes, and eliminate their dependencies on other Omni code. I don't have the source handy at the moment, so I couldn't tell you whether that's a simple matter of getting rid of stuff like OmniBase assertions or if you'd need a lot. Either way, you're quite welcome to use it as an example.
Thank you, sire, for now, however, I am end up just using that layman's example of setting the current number to 101 (for 1.0.1) and then if the next one is bigger it will go to the website....
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status:
Offline
|
|
If only there were some documentation of such tools... *sigh*
|
|
you are not your signature
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
We just have a build number (CFBundleVersion) which is an arbitrary integer that increments sequentially and a marketing version (CFBundleVersionString) like 1.0.1 or whatever.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|