I\'m getting this exception when I try to JSON encode NSDate object.I believe NSDate is not compatible for JSON encoding. but I must encode the date.Any solutions?
Convert NSDate to NSString and try to encode.
- (NSString *) changeDateToDateString :(NSDate *) date {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeZone:[NSTimeZone localTimeZone]];
NSLocale *locale = [NSLocale currentLocale];
NSString *dateFormat = [NSDateFormatter dateFormatFromTemplate:@"hh mm" options:0 locale:locale];
[dateFormatter setDateFormat:dateFormat];
[dateFormatter setLocale:locale];
NSString *dateString = [dateFormatter stringFromDate:date];
return dateString;
}