cordova datepicker plugin not working in iOS8: UITableView dataSource is not set -
After updating to IOS8, the Cordoba Datapiker plugin does not work It crashed with the following message:
Exception exception to end application due to 'NSInternalInconsistencyException', the reason: 'UITableView data source is not set'
but I have no UITableView The related code plugin source code I do not know, that there is an internal UITableView in the UIDPPC?
Here is the code (I'll remove some non-relative code for easy readings):
- Create (UIPopoverController * )Propper: (NSMutableDictionary *) option {UIView * datePickerView = [[UIView alloc] initWithFrame: CGRectMake (0, 0, PickerViewuite, PickwickWhite)]; If (! Self.datePicker) {self.datePicker = [Auto CreateDate Picture: Option Frame: Frame]; [Self.datePicker addTarget: Self action: control events for the @tilt-change action :): UI ControlEventWalls]; } NSDateFormatter * formatter = [Manually formatted formats: @ "Yyen-MM-DD'THH: mm: SS's'" Timezone: [nystimjon default timezone]]; NSString * dateString = [option objectForKey: @ "date"]; Self.datePicker.date = [formatter dateFromString: dateString]; // If you remove this line, then it works fine [datePickerView addSubview: self.datePicker]; UIViewController * datePickerViewController = [[UIViewController alloc] init]; DatePickerViewController.view = datePickerView; UIPopoverController * popover = [[UIPopoverController alloc] initWithContentViewController: datePickerViewController]; Popover.delegate = self; [PopOverSet popover content: CGSizeMake (Pickwickview, PickwickWhite) Animated: No]; [Popover presentPopoverFromRect: View in anchor: self.webView.superview permissionAirrow Deditions: UIPopoverArrowDirectionAny Animated: Yes]; Return popover; }
This row:
self.datePicker.date = [formatter dateFromString: dateString];
Finally leads to the accident, and with debug, I get the value of the date string:
2014-10-17T10: 0: 00Z < / P>
2014-10-17T20: 0: 00Z
And another accident is a crash, it's always okay for the first time
Do you give me some clues Can you? Thank you
Finally I have to find out the problem:
The date of the Cordoba Code, reuse UIDatePicker example:
if (! Self.datePicker) {self.datePicker = [self-made picture]; [Swadetac picture addTarget]; }
And, it works fine in iOS7, but crashes in IOS8.
In iOS8, do not share the UIDatePicker instance in multiple UIViews, so I modified the code:
// In iOS8, the UIDAPPaker will not be shared in multi UIUOU. It could cause the accident. Therefore, create a new UIDAte picture instance every time ([[[UIDewis current divan] system war] float value]> gt; = 8.0) {self.datePicker = [self-bitate pic: option frame: frame]; [Self.datePicker addTarget: Self Action: @Selector (Date Changed Action) Control Events: UIControlEventValueChanged]; } Else {if (! Self.datePicker) {self.datePicker = [self createDatePicker: options frame: frame]; [Self.datePicker addTarget: Self Action: @Selector (Date Changed Action) Control Events: UIControlEventValueChanged]; }}
Hope this can help someone like me
Comments
Post a Comment