set date error on uidatepicker

Posted by Matt Facer on Stack Overflow See other posts from Stack Overflow or by Matt Facer
Published on 2010-04-04T09:05:33Z Indexed on 2010/04/04 9:13 UTC
Read the original article Hit count: 358

Filed under:
|

Hi guys,

I've been stumped by the code below. I pass a string date to a UIDatePicker which seems to work on most devices, yet on some, it crashes the app.

here's the code

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"HH:mm"];
NSDate *date = [dateFormat dateFromString:dateStr];
[timePicker setDate:date];
[dateFormat release];

I have a function which passes the "dateStr" variable, as follows, dateStr = @"0:0"; I cannot see what's wrong - as it works for me! (iphone 3.1.3) but it doesnt work for my tester (ipod touch 3.1.3)

Can anyone see anything wrong with the code?

Thanks v much. any ideas?

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about uidatepicker