FormKit.m
FormKit.m copied to clipboard
UIDatePickerView random crash
There was a problem when using FKFormAttributeMappingTypeDate and rolling the date while simultaneously dismissing the datepicker window. If done at the right moment, the app would crash. The exact moment is to close while the datepicker is stabilizing.
The problem is related to:
[datePicker addTarget:self action:@selector(eventForDatePicker:) forControlEvents:UIControlEventValueChanged];
If the pickerview is dismissed while that event is sent, the app will crash.
A possible solution is to unregister event when the ActionSheetDatePicker is dealloced:
- (void)dealloc {
[((UIDatePicker*)self.pickerView) removeTarget:self action:@selector(eventForDatePicker:) forControlEvents:UIControlEventValueChanged];
}