Im new to obj-c and need some help with this code
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"E, d LLL yyyy HH:mm:ss Z"];
NSDate *date = [dateFormatter dateFromString:currentDate];
the variable date cannot be nil. how can I make it so that date = current time when it’s unable to format the string?
can i use try/catch? how?
Why just not check the date returned from formatter and if it is nil assign current date to it?
Or 1-liner using ternary operator (and its gcc extension):