I am making an iPhone App and I have an NSDate in Core data and I am trying to display it but I keep getting this error:
Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[__NSDate isEqualToString:]: unrecognized selector sent to instance 0x81b7840’.
The code I have below is pulling the data from item which is a dictionary. How can I get this to work?
self.lblTheDate.text = [self.item valueForKey:@"MyDate"];
Use something similar to the following to convert an NSDate (in your dictionary) into an NSString but select the correct date and time styles you require:
There are various options for the date & time styles:
Note that the format for these date and time styles is not exact because they depend on the locale, user preference settings and the operating system version.
Class Reference:
NSDateFormatter