For a beta version of an app, let's say I want to make sure that users cannot 
use the beta for far too long, far longer than the app goes out of beta. (Note 
that this case would in reality rarely occur. Most users would end up getting 
notified of a new update far sooner. This is just a "safety" measure.)

So this is how I thought of doing it. Let's say I want to make the app expire 
on January 1, 2011 (since I'm sure that I'll have a new beta release or go out 
of beta before then). What do you think about putting the following code in 
AppController's awakeFromNib?

-----------------------
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comp setDay:1]; [comp setMonth:1]; [comp setYear:2011];
NSCalendar *gregorian = [[NSCalendar alloc] 
initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *expiryDate = [gregorian dateFromComponents:comps];

NSDate *now = [NSDate date];

if ([now compare:expiryDate] == NSOrderedDescending)
{
  NSRunAlertPanel(@"App Expired",@"Visit website",@"OK",nil,nil);
  [NSApp terminate:self];
  return;
}
-----------------------

Do you think this would work? I mean, it seems that it should, but one can 
never be sure. Plus, this might be a lousy method, compared to what some of you 
geniuses in here might have conjured up over the ages.

Thanks, U.



                                          
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to