FormKit.m icon indicating copy to clipboard operation
FormKit.m copied to clipboard

UIDatePickerView random crash

Open resh32 opened this issue 12 years ago • 0 comments

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];
}

resh32 avatar Apr 29 '13 12:04 resh32