Ok i'm getting just a little peed off at the moment with this so im wondering if anyone here can point me in the right direction.
Im creating a countdown timer at the moment for an iPhone app and im using NSDateFormatter to parse a date from a string into a usable NSDate object to then compare it to the current date. I've gone though and followed all of the correct documents from apple themselves and it works fine on the simulator, but when it comes to the device it just doesn't work at all.
I've been through the documents from apple which can be found here: http://img101.imageshack.us/img101/883/screenshot20100415at180.png and checked the formatting which can be found here: http://unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns but im still having no luck.
The error im getting from the NSDate when i try to assign the NSDateFormatter is <invalid CFStringRef>.
I asked another forum dedicated to iPhone development but they wern't able to give me an answer either, so im hoping the clever people here can point me in the right direction instead
Im creating a countdown timer at the moment for an iPhone app and im using NSDateFormatter to parse a date from a string into a usable NSDate object to then compare it to the current date. I've gone though and followed all of the correct documents from apple themselves and it works fine on the simulator, but when it comes to the device it just doesn't work at all.
Code:
NSDate *dateNow = [NSDate date];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC+2"]];
NSDate *endDate = [dateFormatter dateFromString:[NSString stringWithFormat:@"2010-06-11 16:00"]];
NSTimeInterval interval = [endDate timeIntervalSinceDate:dateNow];
if ([dateNow compare:endDate] == NSOrderedDescending)
{
//Stop Timer
[timerA release];
[self checkExpiry];
}
I've been through the documents from apple which can be found here: http://img101.imageshack.us/img101/883/screenshot20100415at180.png and checked the formatting which can be found here: http://unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns but im still having no luck.
The error im getting from the NSDate when i try to assign the NSDateFormatter is <invalid CFStringRef>.
I asked another forum dedicated to iPhone development but they wern't able to give me an answer either, so im hoping the clever people here can point me in the right direction instead
