无效的参数并不令人满意:日期(Invalid parameter not satisfying: d

2019-09-18 08:17发布

我在从Crashlytics进来的问题。 我有,所以我看到有什么参数调试参数。

datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 40, 0, 0)];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSString *startTimeString = [MathFunctions minutesToTimeString:[appointment.start_time integerValue]];
    NSLog(@"Time: %@",startTimeString);
    NSLog(@"Date: %@", appointment.date);
    [dateFormatter setDateFormat:@"yyyyMMdd h:mm a"];
    [Crashlytics setObjectValue:[NSString stringWithFormat:@"%@ %@", appointment.date, startTimeString] forKey:@"ResAddDate"];
    NSString *dateTimeString = [NSString stringWithFormat:@"%@ %@", appointment.date, startTimeString];
    NSLog(@"Date String: %@", dateTimeString);
    datePicker.date = [dateFormatter dateFromString:dateTimeString];

从crashlytics未来的系统崩溃日志显示,日期的格式正确

RESADDDATE: 20120621 12:00 AM

上发生崩溃datePicker.date = [dateFormatter dateFromString:dateTimeString];

这是为什么崩溃如果日期格式是存在的,正确的吗?

Crashlytics日志:

CoreFoundation  
__exceptionPreprocess + 162
1    libobjc.A.dylib    
objc_exception_throw + 32
2    CoreFoundation 
+[NSException raise:format:]
3    Foundation 
-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 90
4    UIKit  
-[UIDatePickerView _updateBitsForDate:forced:andReload:animateIfNeeded:] + 146
5    UIKit  
-[UIDatePickerView _setDate:animated:forced:] + 348
6    UIKit  
-[UIDatePickerView setDate:animated:] + 30
7    UIKit  
-[UIDatePicker setDate:] + 36
8    MyApp   ReserveAddController.m line 283
-[ReserveAddController showDatePicker] + 283
9    MyApp   ReserveAddController.m line 179
-[ReserveAddController tableView:didSelectRowAtIndexPath:] + 179
10   UIKit  
-[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 944
11   UIKit  
-[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 158
12
Foundation  
__NSFireDelayedPerform + 414
13   CoreFoundation 
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
14   CoreFoundation 
__CFRunLoopDoTimer + 364
15   CoreFoundation 
__CFRunLoopRun + 1206
16   CoreFoundation 
CFRunLoopRunSpecific + 300
17   CoreFoundation 
CFRunLoopRunInMode + 104
18   GraphicsServices   
GSEventRunModal + 136
19   UIKit  
UIApplicationMain + 1080
20   Appointment-Plus    main.m line 16
main + 16
21   Appointment-Plus

Answer 1:

请注意,您可以通过语言环境“越来越有点feechure ”。 你需要设置你的NSDateFormatter的语言环境。

与美国的区域设置,然后12/24设置设为24还设置了手机与欧洲语言环境,然后设置12/24设置为12可能的一个或另一个或两个将无法建立一个电话。



文章来源: Invalid parameter not satisfying: date