jumartin / Calendar

A set of views and controllers for displaying and scheduling events on iOS
MIT License
701 stars 203 forks source link

Clicking day view in the demo throws an exception #72

Open juliany opened 7 years ago

juliany commented 7 years ago

When i click the day view in the demo i get the following exception

This occurs is IOS 8.1 but not IOS9

2017-01-30 09:48:38.281 CalendarDemo[65540:5596593] selected day at : 2017-02-07 23:00:00 +0000 2017-01-30 09:48:39.735 CalendarDemo[65540:5596593] -[MGCCalendarHeaderView setRemembersLastFocusedIndexPath:]: unrecognized selector sent to instance 0x7f897109f800 2017-01-30 09:48:39.736 CalendarDemo[65540:5596593] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MGCCalendarHeaderView setRemembersLastFocusedIndexPath:]: unrecognized selector sent to instance 0x7f897109f800' First throw call stack: ( 0 CoreFoundation 0x00000001122bcf35 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000111f57bb7 objc_exception_throw + 45 2 CoreFoundation 0x00000001122c404d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000011221c27c __forwarding + 988 4 CoreFoundation 0x000000011221be18 _CF_forwarding_prep_0 + 120 5 CalendarLib 0x000000010ff5f336 -[MGCCalendarHeaderView initWithFrame:collectionViewLayout:andDayPlannerView:] + 1494 6 CalendarLib 0x000000010ff846d3 -[MGCDayPlannerViewController setupHeaderView] + 419 7 CalendarLib 0x000000010ff84520 -[MGCDayPlannerViewController viewDidLayoutSubviews] + 464 8 UIKit 0x000000011087b9a6 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 572 9 QuartzCore 0x00000001127a1de8 -[CALayer layoutSublayers] + 150 10 QuartzCore 0x0000000112796a0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 11 QuartzCore 0x000000011279687e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 12 QuartzCore 0x000000011270463e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242 13 QuartzCore 0x000000011270574a _ZN2CA11Transaction6commitEv + 390 14 UIKit 0x00000001107ff14d _UIApplicationHandleEventQueue + 2035 15 CoreFoundation 0x00000001121f2551 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 16 CoreFoundation 0x00000001121e841d CFRunLoopDoSources0 + 269 17 CoreFoundation 0x00000001121e7a54 CFRunLoopRun + 868 18 CoreFoundation 0x00000001121e7486 CFRunLoopRunSpecific + 470 19 GraphicsServices 0x0000000115a379f0 GSEventRunModal + 161 20 UIKit 0x0000000110802420 UIApplicationMain + 1282 21 CalendarDemo 0x000000010feaa3ef main + 111 22 libdyld.dylib 0x0000000112b64145 start + 1 23 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

virendall commented 7 years ago

put this condition in MGCCalendarHeaderView as remembersLastFocusedIndexPath available after

iOS 9.0

if([[[UIDevice currentDevice] systemVersion] integerValue] > 9) 
{
    self.remembersLastFocusedIndexPath = YES;
}