I have created a post several hours ago, but that was incorrect, I was mistaken about the thing that cause crash. So I have repost it, I hope you will not blame me for that.
I got a view that own a datePicker, my point is to show NOT current date at picker, but show "old" date (I choose 1987 year). But I have no idea what goes wrong, when I launch app on simulator it works perfectly fine, but when I switch to iPhone app crash before view loads. There is the code:
-(void)defaultBirthdayPickerDate{
NSString *dateString = @"09-Oct-1987";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
dateFormatter.dateFormat = @"dd-MMM-yyyy";
NSDate *date = [dateFormatter dateFromString:dateString];
[self.birthdayPicker setDate:date];
}
Then:
- (void)viewDidLoad
{
[self defaultBirthdayPickerDate];
[super viewDidLoad];
}
There is the thing, somewhere something cause a crash:
2013-03-05 15:50:31.070 DeathLine[2985:907] *** Assertion failure in -[_UIDatePickerView _setDate:animated:forced:], /SourceCache/UIKit/UIKit-2380.17/_UIDatePickerView.m:302
2013-03-05 15:50:31.073 DeathLine[2985:907] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: date'
*** First throw call stack:
(0x325042a3 0x3a22197f 0x3250415d 0x32dd9ab7 0x344bdf15 0x344c6429 0x3458f989 0x14a6b 0x148db 0x3432b595 0x3438014b 0x34380091 0x3437ff75 0x3437fe99 0x3437f5d9 0x3437f4c1 0x3436db93 0x28f4c33 0x3436d833 0x343f70c5 0x343f7077 0x343f7055 0x343f690b 0x343f6e01 0x3431f5f1 0x3430c801 0x3430c11b 0x360225a3 0x360221d3 0x324d9173 0x324d9117 0x324d7f99 0x3244aebd 0x3244ad49 0x360212eb 0x34360301 0xcc21 0x3a658b20)
libc++abi.dylib: terminate called throwing an exception
Somehow [self.birthdayPicker.date]
is not NULL, I know it, but I have no idea how to fix an issue.