objc-TimesSquare icon indicating copy to clipboard operation
objc-TimesSquare copied to clipboard

Scary console output when setting selected date to nil

Open percysnoodle opened this issue 12 years ago • 0 comments

When setting the selectedDate property to nil, I get this warning:

2013-03-19 08:44:58.903 MyApp[73936:c07] *** -[__NSCFCalendar components:fromDate:]: date cannot be nil
I mean really, what do you think that operation is supposed to mean with a nil date?
An exception has been avoided for now.
A few of these errors are going to be reported with this complaint, then further violations will simply silently do whatever random thing results from the nil.
Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
(
    0   CoreFoundation                      0x0271aa75 -[__NSCFCalendar components:fromDate:] + 85
    1   MyApp                          0x001c5220 -[TSQCalendarView clampDate:toComponents:] + 128
    2   MyApp                          0x001c265e -[TSQCalendarView setSelectedDate:] + 94
    3   MyApp                          0x0011ba19 -[C3CDateView initWithSelectedDate:] + 841
    4   MyApp                          0x0011b1ad -[C3CDateController loadView] + 125
    5   UIKit                               0x014baff8 -[UIViewController loadViewIfRequired] + 73
    6   UIKit                               0x014bb232 -[UIViewController view] + 33
    7   UIKit                               0x014bb4da -[UIViewController contentScrollView] + 36
    8   UIKit                               0x014d28e5 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 36
    9   UIKit                               0x014d29cb -[UINavigationController _layoutViewController:] + 43
    10  UIKit                               0x014d2c76 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 254
    11  UIKit                               0x014d2d71 -[UINavigationController _startTransition:fromViewController:toViewController:] + 72
    12  UIKit                               0x014d389b -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
    13  UIKit                               0x014d39b9 -[UINavigationController _startDeferredTransitionIfNeeded] + 41
    14  UIKit                               0x014d0c15 -[UINavigationController defaultFirstResponder] + 156
    15  UIKit                               0x014e8a72 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 36
    16  UIKit                               0x014e8b2a -[UIResponder(Internal) _promoteDeepestDefaultFirstResponder] + 36
    17  UIKit                               0x016c80e6 -[UIWindowController transitionViewDidStart:] + 84
    18  UIKit                               0x0149966a -[UITransitionView _didStartTransition] + 82
    19  UIKit                               0x0149a498 -[UITransitionView transition:fromView:toView:removeFromView:] + 1286
    20  UIKit                               0x016c7f44 __91-[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:]_block_invoke_0238 + 485
    21  UIKit                               0x016c74ee -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 6377
    22  UIKit                               0x014c3ee3 -[UIViewController presentViewController:withTransition:completion:] + 4521
    23  UIKit                               0x014c4167 -[UIViewController presentViewController:animated:completion:] + 112
    24  UIKit                               0x0b683071 -[UIViewControllerAccessibility(SafeCategory) presentViewController:animated:completion:] + 71
    25  MyApp                          0x00019f8b -[C3CSurveyController showDateControllerForQuestion:] + 523
    26  MyApp                          0x00017655 -[C3CSurveyController questionsTable:didSelectQuestionAtIndexPath:] + 197
    27  MyApp                          0x0000fa66 -[C3CQuestionsTable tableView:didSelectRowAtIndexPath:] + 134
    28  UIKit                               0x01489285 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1194
    29  UIKit                               0x014894ed -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 201
    30  Foundation                          0x01e935b3 __NSFireDelayedPerform + 380
    31  CoreFoundation                      0x026cc376 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    32  CoreFoundation                      0x026cbe06 __CFRunLoopDoTimer + 534
    33  CoreFoundation                      0x026b3a82 __CFRunLoopRun + 1810
    34  CoreFoundation                      0x026b2f44 CFRunLoopRunSpecific + 276
    35  CoreFoundation                      0x026b2e1b CFRunLoopRunInMode + 123
    36  GraphicsServices                    0x0307e7e3 GSEventRunModal + 88
    37  GraphicsServices                    0x0307e668 GSEventRun + 104
    38  UIKit                               0x013d9ffc UIApplicationMain + 1211
    39  MyApp                          0x000024ed main + 141
    40  MyApp                          0x00002415 start + 53
    41  ???                                 0x00000001 0x0 + 1
)

I guess this is because setSelectedDate: is performing some calculations to work out which cell to select.

percysnoodle avatar Mar 19 '13 08:03 percysnoodle