UIDatePicker crash the app when the device region is Indonesia and the calendar is the Buddhist one

Originator:rodrigodeplcampos1
Number:rdar://41120005 Date Originated:June 14 2018
Status:Open Resolved:
Product:iOS Product Version:11
Classification: Reproducible:
 
Summary:
It happens with some Region/Calendar combinations. When instantiating an UIDatePicker and configuring an UIDatePickerModeDate, if the device region is set to Indonesia and the calendar is set to the Buddhist, the app will crash 100% of the times.

Steps to Reproduce:
- Create a brand new "Single View App" project (It happens on both Objective-C and Swift)
- Open the ViewController.m file (if Objective-C), and add the following lines to the viewDidLoad method, bellow [super viewDidLoad]:
    UIDatePicker *datePicker = [UIDatePicker new];
    datePicker.datePickerMode = UIDatePickerModeDate;
- Make sure that the device's region is set to Indonesia and the calendar to the Buddhist one
- Build and Run the app

Expected Results:
The blank screen appears and nothing else should happen

Actual Results:
The app crashes with the following uncaught exception :
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unexpected number of calendar units: 4 for format: EEE ├'day': d┤ HH.mm (expecting at least 5 elements)'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001086c01e6 __exceptionPreprocess + 294
	1   libobjc.A.dylib                     0x000000010576c031 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001086c5472 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x0000000104e1a652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
	4   UIKit                               0x0000000106b2d649 -[_UIDatePickerMode_DateAndTime elements] + 514
	5   UIKit                               0x0000000106b27359 -[_UIDatePickerMode displayedCalendarUnits] + 33
	6   UIKit                               0x0000000106b2d42d -[_UIDatePickerMode_DateAndTime displayedCalendarUnits] + 41
	7   UIKit                               0x0000000106b1a9a3 -[_UIDatePickerView _setMode:] + 103
	8   UIKit                               0x0000000106b1ac01 -[_UIDatePickerView setDatePickerMode:] + 222
...

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!