Hi Team,
I am using NSDateFormatter to print date and time in my logger class.
// Get current date and time
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
NSString *dateTimeString = [dateFormatter stringFromDate:[NSDate date]];
I am using the NSDateFormatter as shown in the above snippet, but I am seeing random crashes with the below stack trace. This crash is random and can't be reproduced consistently.
0 libobjc.A.dylib 0x7ff8051a021d objc_msgSend + 29
1 CoreFoundation 0x7ff8056609ef __CFDateFormatterSetSymbolsArray + 59
2 CoreFoundation 0x7ff80564db87 __ApplyUDateFormatSymbol + 324
3 CoreFoundation 0x7ff80564c854 __ResetUDateFormat + 3064
4 CoreFoundation 0x7ff80564bc30 __CreateCFDateFormatter + 320
5 Foundation 0x7ff8064c2ae3 -[NSDateFormatter _regenerateFormatter] + 323
6 Foundation 0x7ff8064c2858 -[NSDateFormatter stringForObjectValue:] + 297
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000018
Exception Codes: 0x0000000000000001, 0x0000000000000018
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [5372]
Can someone please suggest if there is something wrong in the way NSDateFormatter being used?
I checked the documentation and found nothing that can be causing this issue.
Thanks and Regards