The app work fine before iOS 11 update. After iOS 11 rollout, some user get this below crash but I cannot reproduce this in simulator iOS 11. Based on fabric.io, not all iOS
We saw the same issue in our app and were able to fix by setting the date picker's calendar type to 'Gregorian' BEFORE setting any other date picker property, e.g.
self.inputDatePicker = [[DatePickerView alloc] init...];
self.inputDatePicker.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]
self.inputDatePicker.datePicker.datePickerMode = UIDatePickerModeDate;
self.inputDatePicker.delegate = self;
We reproduced on an iOS11 iPhone 6S by changing the user's calendar to Buddhist.
For some reason the app would crash if we set the calendar AFTER setting the date picker mode... seems like an Apple bug to force devs to have to think about the order in which we set our properties.
You have wrong on setup view from nib. You can use my library or watch code how I adding components from xib.
RMNibLoadedView
Not a complete solution but if it's trying to remove an object at index 9223372036854775807, it's worth pointing out that isn't a random number its the maximum value a 64 bit integer can hold
So somewhere maybe it's caught in a loop, or something along those lines. If you haven't already, upload your .dysm file to Fabric and it will give you more informative crash reports (even from the reports you already have) with function names, variables etc so you can pinpoint it to code more accurately
First of all - why do u set property twice here?...
self.inputDatePicker = [[DatePickerView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 260)];
self.inputDatePicker = [nib objectAtIndex:0];
If you want to make sure that this property will be not nil, just check returned nib array and if it's empty do something else.
According to crash log your array is cleaned before u are trying to get some value from. So try to change
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"DatePickerView" owner:self options:nil]; //here is (VerifyAccountViewController.m:47)
self.inputDatePicker = [[DatePickerView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 260)];
self.inputDatePicker = [nib objectAtIndex:0];
to
self.inputDatePicker = [[[NSBundle mainBundle] loadNibNamed:@"DatePickerView" owner:self options:nil] firstObject];
if (self.inputDatePicker == nil) {
// do something or perhaps better to check you nib
}
About FirstObject.
Did u have a chance to check nib
content. Is it contains requested view or it's empty? If empty check name of your xib file. I personally prefer to write name of xib in something like NSStringFromClass([self class])
- of cause this require same name for class and xib file, but less error prone.