Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Cocoa:: Checking Internet For Updates....

Cocoa:: Checking Internet For Updates....
Thread Tools
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status: Offline
Reply With Quote
May 13, 2003, 08:22 PM
 
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
Reply With Quote
May 14, 2003, 05:32 AM
 
If you wan't lots of info - perhaps instead of using a text file you could archive an NSDictionary?
You know it makes sense. ☼ ☼ ☼ Growl.
     
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status: Offline
Reply With Quote
May 14, 2003, 07:04 AM
 
Hm... interesting.......
     
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
May 14, 2003, 09:06 AM
 
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
Reply With Quote
May 14, 2003, 03:19 PM
 
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).
Rick Roe
icons.cx | weblog
     
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status: Offline
Reply With Quote
May 14, 2003, 05:11 PM
 
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
Reply With Quote
May 14, 2003, 09:43 PM
 
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.
Rick Roe
icons.cx | weblog
     
Mac Elite
Join Date: Sep 2000
Location: 'round the corner
Status: Offline
Reply With Quote
May 14, 2003, 11:28 PM
 
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
Reply With Quote
May 15, 2003, 10:31 AM
 
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
Reply With Quote
May 15, 2003, 12:17 PM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:33 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2