hey guys, im taking a dip into OSX developing and im making fair progress in my first few apps for both iphone os and osx, but i was wondering if theres something i can put in the code that makes the current beta build run for only a few days, and after those days the app refuses to launch.
Id rather it be a time limit as opposed to a certain number of runs, but whatever is more practical will work
NSDateFormatter * newFormatter = [[NSDateFormatter alloc] init];
[newFormatter setDateFormat:@"dd mm yyyy"];
NSDate * endDate = [newFormatter dateFromString:@"04 01 2010"]; //This is the end date, this is what we're checking for
[newFormatter release];
NSDate * nowDate = [NSDate date];
if ([nowDate compare:endDate] == NSOrderedDescending){
NSLog(@"expired");
//Show message, then quit
}
else
{
NSLog(@"nope, still good");
//It hasn't expired yet.
}
I created endDate in the way shown above just as a quick example and doesn't have a time or anything, just a date. The important bit is the comparison to see if the endDate has passed.
NSDateFormatter * newFormatter = [[NSDateFormatter alloc] init];
[newFormatter setDateFormat:@"dd mm yyyy"];
NSDate * endDate = [newFormatter dateFromString:@"04 01 2010"]; //This is the end date, this is what we're checking for
[newFormatter release];
NSDate * nowDate = [NSDate date];
if ([nowDate compare:endDate] == NSOrderedDescending){
NSLog(@"expired");
//Show message, then quit
}
else
{
NSLog(@"nope, still good");
//It hasn't expired yet.
}
I created endDate in the way shown above just as a quick example and doesn't have a time or anything, just a date. The important bit is the comparison to see if the endDate has passed.
Tom
so if i know my stuff right, i would pop this into the applicationDidFinishLaunching method? or is that only in the iphone version?
also how do you make the app quit? on both OSX and iphoneOS