Juanpe / SkeletonView

☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting
MIT License
12.62k stars 1.12k forks source link

Crash when pushing view controller with date picker on top of view controller with skeleton started and stopped #259

Closed minaMagedNaeem closed 3 years ago

minaMagedNaeem commented 4 years ago

What did you do?

tried to push a view controller with a DatePickerView with mode set to .time when there was a view controller with skeletonable views in the navigation controller stack

What did you expect to happen?

The view controller will be pushed and I will be able to see the DatePickerView

What happened instead?

The app crashed on appDelegate start

Call Stack


    0   CoreFoundation                      0x00000001176578db __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x0000000116640ac5 objc_exception_throw + 48
    2   CoreFoundation                      0x00000001175a5fac _CFThrowFormattedException + 194
    3   CoreFoundation                      0x00000001175824e2 -[__NSArrayM objectAtIndex:] + 178
    4   UIKitCore                           0x000000011bb40d70 -[UIPickerView selectedRowInComponent:] + 76
    5   UIKitCore                           0x000000011bb289c1 -[_UIDatePickerMode_Time _shouldEnableValueForRow:inComponent:calendarUnit:] + 234
    6   UIKitCore                           0x000000011bb268b9 -[_UIDatePickerMode _shouldEnableValueForRow:column:] + 68
    7   UIKitCore                           0x000000011bb2646d -[_UIDatePickerMode viewForRow:inComponent:reusingView:] + 942
    8   UIKitCore                           0x000000011bb32086 -[_UIDatePickerView pickerView:viewForRow:forComponent:reusingView:] + 60
    9   UIKitCore                           0x000000011bb4149c -[UIPickerView tableView:cellForRowAtIndexPath:] + 620
    10  UIKitCore                           0x000000011bb34a06 -[UIPickerColumnView tableView:cellForRowAtIndexPath:] + 168
    11  UIKitCore                           0x000000011bde5f60 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 764
    12  UIKitCore                           0x000000011bde6499 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 73
    13  UIKitCore                           0x000000011bdae654 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2870
    14  UIKitCore                           0x000000011bdc2c28 -[UITableView _visibleCellsUsingPresentationValues:] + 518
    15  SkeletonView                        0x00000001152ba663 $sSo11UITableViewC08SkeletonB0E010subviewsToC0SaySo6UIViewCGvg + 35
    16  SkeletonView                        0x00000001152ba5f5 $sSo11UITableViewC08SkeletonB0E010subviewsToC0SaySo6UIViewCGvgTo + 53
    17  SkeletonView                        0x00000001152ba2d6 $sSo6UIViewC12SkeletonViewE21subviewsSkeletonablesSayABGvg + 54
    18  SkeletonView                        0x00000001152ba255 $sSo6UIViewC12SkeletonViewE21subviewsSkeletonablesSayABGvgTo + 53
    19  SkeletonView                        0x00000001152cb0d6 $sSo6UIViewC12SkeletonViewE02isB6ActiveSbvg + 182
    20  SkeletonView                        0x00000001152b71b3 $sSo6UIViewC12SkeletonViewE32skeletonTraitCollectionDidChangeyySo07UITraitF0CSgF + 131
    21  SkeletonView                        0x00000001152b7294 $sSo6UIViewC12SkeletonViewE32skeletonTraitCollectionDidChangeyySo07UITraitF0CSgFTo + 68
    22  UIKitCore                           0x000000011c0144b2 -[UIScrollView traitCollectionDidChange:] + 73
    23  UIKitCore                           0x000000011bdb9bd0 -[UITableView traitCollectionDidChange:] + 74
    24  UIKitCore                           0x000000011c05f27a -[UIView _traitCollectionDidChangeInternal:] + 780
    25  UIKitCore                           0x000000011c05f341 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 137
    26  UIKitCore                           0x000000011c05f44e -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 406
    27  UIKitCore                           0x000000011c05f44e -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 406
    28  UIKitCore                           0x000000011bfc12b7 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 104
    29  UIKitCore                           0x000000011c05f654 -[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:] + 129
    30  UIKitCore                           0x000000011c072bdc __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 733
    31  Foundation                          0x0000000110f94f46 -[NSISEngine withBehaviors:performModifications:] + 110
    32  UIKitCore                           0x000000011c072890 -[UIView(Hierarchy) _postMovedFromSuperview:] + 822
    33  UIKitCore                           0x000000011c082ae5 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1948
    34  UIKitCore                           0x000000011bb3eb5c __30-[UIPickerView layoutSubviews]_block_invoke + 5320
    35  UIKitCore                           0x000000011c07aec1 +[UIView(Animation) performWithoutAnimation:] + 90
    36  UIKitCore                           0x000000011bb3d665 -[UIPickerView layoutSubviews] + 119
    37  UIKitCore                           0x000000011bb32397 -[_UIDatePickerView layoutSubviews] + 101
    38  UIKitCore                           0x000000011bb40d51 -[UIPickerView selectedRowInComponent:] + 45
    39  UIKitCore                           0x000000011bb3bc09 -[UIPickerView _updateSelectedRows] + 135
    40  UIKitCore                           0x000000011bb3bca3 -[UIPickerView didMoveToWindow] + 101
    41  UIKitCore                           0x000000011c07ff9d -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1817
    42  UIKitCore                           0x000000011c07fb47 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 707
    43  UIKitCore                           0x000000011b5ffde4 -[UIControl _didMoveFromWindow:toWindow:] + 67
    44  UIKitCore                           0x000000011c07fb47 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 707
    45  UIKitCore                           0x000000011c07fb47 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 707
    46  UIKitCore                           0x000000011c07fb47 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 707
    47  UIKitCore                           0x000000011c07fb47 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 707
    48  UIKitCore                           0x000000011c072996 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151
    49  Foundation                          0x0000000110f94f46 -[NSISEngine withBehaviors:performModifications:] + 110
    50  UIKitCore                           0x000000011c072890 -[UIView(Hierarchy) _postMovedFromSuperview:] + 822
    51  UIKitCore                           0x000000011c082ae5 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1948
    52  UIKitCore                           0x000000011bdb05d3 -[UITableView _addSubview:positioned:relativeTo:] + 124
    53  UIKitCore                           0x000000011c01e24d -[UIScrollView(UIScrollViewInternal) _addContentSubview:atBack:] + 564
    54  UIKitCore                           0x000000011bdb032c -[UITableView _addContentSubview:atBack:] + 256
    55  UIKitCore                           0x000000011bdd3ca2 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 2476
    56  UIKitCore                           0x000000011c07aec1 +[UIView(Animation) performWithoutAnimation:] + 90
    57  UIKitCore                           0x000000011bdd320f -[UITableView _configureCellForDisplay:forIndexPath:] + 237
    58  UIKitCore                           0x000000011bde5ff3 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 911
    59  UIKitCore                           0x000000011bde6499 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 73
    60  UIKitCore                           0x000000011bdae654 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2870
    61  UIKitCore                           0x000000011bdc2c28 -[UITableView _visibleCellsUsingPresentationValues:] + 518
    62  SkeletonView                        0x00000001152ba663 $sSo11UITableViewC08SkeletonB0E010subviewsToC0SaySo6UIViewCGvg + 35
    63  SkeletonView                        0x00000001152ba5f5 $sSo11UITableViewC08SkeletonB0E010subviewsToC0SaySo6UIViewCGvgTo + 53
    64  SkeletonView                        0x00000001152ba2d6 $sSo6UIViewC12SkeletonViewE21subviewsSkeletonablesSayABGvg + 54
    65  SkeletonView                        0x00000001152ba255 $sSo6UIViewC12SkeletonViewE21subviewsSkeletonablesSayABGvgTo + 53
    66  SkeletonView                        0x00000001152cb0d6 $sSo6UIViewC12SkeletonViewE02isB6ActiveSbvg + 182
    67  SkeletonView                        0x00000001152b71b3 $sSo6UIViewC12SkeletonViewE32skeletonTraitCollectionDidChangeyySo07UITraitF0CSgF + 131
    68  SkeletonView                        0x00000001152b7294 $sSo6UIViewC12SkeletonViewE32skeletonTraitCollectionDidChangeyySo07UITraitF0CSgFTo + 68
    69  UIKitCore                           0x000000011c0144b2 -[UIScrollView traitCollectionDidChange:] + 73
    70  UIKitCore                           0x000000011bdb9bd0 -[UITableView traitCollectionDidChange:] + 74
    71  UIKitCore                           0x000000011c05f27a -[UIView _traitCollectionDidChangeInternal:] + 780
    72  UIKitCore                           0x000000011c05f341 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 137
    73  UIKitCore                           0x000000011c05f44e -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 406
    74  UIKitCore                           0x000000011bfc12b7 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 104
    75  UIKitCore                           0x000000011c05f654 -[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:] + 129
    76  UIKitCore                           0x000000011c088e01 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1313
    77  QuartzCore                          0x00000001130a5d22 -[CALayer layoutSublayers] + 173
    78  QuartzCore                          0x00000001130aa9fc _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 396
    79  QuartzCore                          0x00000001130b6d58 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 72
    80  QuartzCore                          0x000000011302624a _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 328
    81  QuartzCore                          0x000000011305d606 _ZN2CA11Transaction6commitEv + 610
    82  QuartzCore                          0x0000000112f928a7 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 951
    83  QuartzCore                          0x00000001130615a9 _ZL22display_timer_callbackP12__CFMachPortPvlS1_ + 297
    84  CoreFoundation                      0x0000000117593266 __CFMachPortPerform + 150
    85  CoreFoundation                      0x00000001175bf5e9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
    86  CoreFoundation                      0x00000001175bec4b __CFRunLoopDoSource1 + 459
    87  CoreFoundation                      0x00000001175b91da __CFRunLoopRun + 2490
    88  CoreFoundation                      0x00000001175b84d2 CFRunLoopRunSpecific + 626
    89  GraphicsServices                    0x000000011e7602fe GSEventRunModal + 65
    90  UIKitCore                           0x000000011bba9fc2 UIApplicationMain + 140
    91  Koinz                               0x000000010d1adc3b main + 75
    92  libdyld.dylib                       0x00000001190de541 start + 1
    93  ???                                 0x0000000000000007 0x0 + 7

Steps to reproduce the behavior

  1. Push a view controller with skeletonable views(isSkeletonable = true and the skeleton started and then it was stopped)
  2. Push on it a new view controller with a DateTimePicker with mode set to .Time Note: it works on ios13 but crashes on lower than ios13

SkeletonView Environment

SkeletonView version: 1.8.5 Xcode version: 11.3.1 Swift version: Swift 5

minaMagedNaeem commented 4 years ago

Note: The viewController with skeletonable views has a table view and its cells are skeletonable

Juanpe commented 4 years ago

Hi @minaMagedNaeem, version 1.8.6 is ready to use. This version has a change related to trait collection changes, but I don't know if it will solve this issue. Could you check it?

Thanks

minaMagedNaeem commented 4 years ago

No, The issue is still happening

Juanpe commented 4 years ago

Sorry, I can’t reproduce this issue. Could you provide an example with the code with which you are getting this crash, please?

minaMagedNaeem commented 4 years ago

SkeletonCrash.zip

minaMagedNaeem commented 4 years ago

Skeleton view version: 1.8.6 iOS version: 12.4

bagusandinata commented 4 years ago

Hai, I experienced the same thing on iOS 12 @Juanpe . After I tracked it, this happened in version 1.8.3. Thanks

byMohamedali commented 4 years ago

Hello, Have you find a solution ?

Nobin272 commented 4 years ago

I am also facing same issue with DatePicker. Application is crashing with same logs.

2020-02-27 18:53:38.765319+0800 MIHP[13650:325088] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 3 beyond bounds [0 .. 1]'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000112cc81ab __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00000001113a6f41 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000112d07f9c _CFThrowFormattedException + 194
    3   CoreFoundation                      0x0000000112bf809f -[__NSArrayM objectAtIndex:] + 175
    4   UIKit                               0x000000010efef389 -[UIPickerView selectedRowInComponent:] + 76
    5   UIKit                               0x000000010fb3e35c -[_UIDatePickerMode_DateAndTime _shouldEnableValueForRow:inComponent:calendarUnit:] + 266
    6   UIKit                               0x000000010fb39ed9 -[_UIDatePickerMode _shouldEnableValueForRow:column:] + 68
    7   UIKit                               0x000000010fb39a6f -[_UIDatePickerMode viewForRow:inComponent:reusingView:] + 956
    8   UIKit                               0x000000010fb3e5c2 -[_UIDatePickerMode_DateAndTime viewForRow:inComponent:reusingView:] + 206
    9   UIKit                               0x000000010fb2c3d9 -[_UIDatePickerView pickerView:viewForRow:forComponent:reusingView:] + 60
    10  UIKit                               0x000000010efefac6 -[UIPickerView tableView:cellForRowAtIndexPath:] + 621
    11  UIKit                               0x000000010fb16428 -[UIPickerColumnView tableView:cellForRowAtIndexPath:] + 168
    12  UIKit                               0x000000010f169e45 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 778
    13  UIKit                               0x000000010f16a3eb -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
    14  UIKit                               0x000000010f1305f0 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2892
    15  UIKit                               0x000000010f146199 -[UITableView _visibleCellsUsingPresentationValues:] + 514
    16  SkeletonView                        0x000000010ea27dad $sSo11UITableViewC08SkeletonB0E010subviewsToC0SaySo6UIViewCGvg + 61
    17  SkeletonView                        0x000000010ea27d25 $sSo11UITableViewC08SkeletonB0E010subviewsToC0SaySo6UIViewCGvgTo + 53
    18  SkeletonView                        0x000000010ea279e7 $sSo6UIViewC12SkeletonViewE21subviewsSkeletonablesSayABGvg + 71
    19  SkeletonView                        0x000000010ea27955 $sSo6UIViewC12SkeletonViewE21subviewsSkeletonablesSayABGvgTo + 53
    20  SkeletonView                        0x000000010ea3a909 $sSo6UIViewC12SkeletonViewE02isB6ActiveSbvg + 217
    21  SkeletonView                        0x000000010ea245fb $sSo6UIViewC12SkeletonViewE32skeletonTraitCollectionDidChangeyySo07UITraitF0CSgF + 171
    22  SkeletonView                        0x000000010ea246e4 $sSo6UIViewC12SkeletonViewE32skeletonTraitCollectionDidChangeyySo07UITraitF0CSgFTo + 68
    23  UIKit                               0x000000010f0fcd8c -[UIScrollView traitCollectionDidChange:] + 73
    24  UIKit                               0x000000010f13bfd8 -[UITableView traitCollectionDidChange:] + 74
    25  UIKit                               0x000000010f0afe40 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 163
    26  UIKit                               0x000000010f0aff3c -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 415
    27  UIKit                               0x000000010f0aff3c -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 415
    28  UIKit                               0x000000010fb7e2bb -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 104
    29  UIKit                               0x000000010f0b01f7 -[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:] + 151
    30  UIKit                               0x000000010f0c43b4 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 767
    31  Foundation                          0x000000010d0e8de1 -[NSISEngine withBehaviors:performModifications:] + 131
    32  UIKit                               0x000000010f0c404e -[UIView(Hierarchy) _postMovedFromSuperview:] + 855
    33  UIKit                               0x000000010f0d494d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973
    34  UIKit                               0x000000010efed00a __30-[UIPickerView layoutSubviews]_block_invoke + 5377
    35  UIKit                               0x000000010f0cc8f0 +[UIView(Animation) performWithoutAnimation:] + 90
    36  UIKit                               0x000000010efebacb -[UIPickerView layoutSubviews] + 159
    37  UIKit                               0x000000010fb2c718 -[_UIDatePickerView layoutSubviews] + 103
    38  UIKit                               0x000000010efef36a -[UIPickerView selectedRowInComponent:] + 45
    39  UIKit                               0x000000010efe9fdc -[UIPickerView _updateSelectedRows] + 143
    40  UIKit                               0x000000010efea076 -[UIPickerView didMoveToWindow] + 101
    41  UIKit                               0x000000010f0d1dd7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1748
    42  UIKit                               0x000000010f0d1a14 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 785
    43  UIKit                               0x000000010f188926 -[UIControl _didMoveFromWindow:toWindow:] + 67
    44  UIKit                               0x000000010f0c414c __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151
    45  Foundation                          0x000000010d0e8de1 -[NSISEngine withBehaviors:performModifications:] + 131
    46  UIKit                               0x000000010f0c404e -[UIView(Hierarchy) _postMovedFromSuperview:] + 855
    47  UIKit                               0x000000010f0d494d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973
..
...
    51  UIKit                               0x000000010f0cde35 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 859
    52  UIKit                               0x000000010f0a099d -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 354
    53  UIKit                               0x000000010f0a0fde -[UIViewAnimationState animationDidStop:finished:] + 293
    54  QuartzCore                          0x000000010e5a2a2b _ZN2CA5Layer23run_animation_callbacksEPv + 323
    55  libdispatch.dylib                   0x00000001145f743c _dispatch_client_callout + 8
    56  libdispatch.dylib                   0x00000001146026f0 _dispatch_main_queue_callback_4CF + 628
    57  CoreFoundation                      0x0000000112c8aee9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    58  CoreFoundation                      0x0000000112c4f592 __CFRunLoopRun + 2402
    59  CoreFoundation                      0x0000000112c4e9b9 CFRunLoopRunSpecific + 409
    60  GraphicsServices                    0x000000011767c9c6 GSEventRunModal + 62
    61  UIKit                               0x000000010f00a5e8 UIApplicationMain + 159
    63  libdyld.dylib                       0x0000000114673d81 start + 1
    64  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
bagusandinata commented 4 years ago

The best solution for now used version 1.8.2 @byMohamedali

byMohamedali commented 4 years ago

Thank you @bagusandinata, The bug seems to append on iOS 12.3.1, it's working fine on iOS 12.2

roarapps commented 4 years ago

Also experienced the same in our app, unfortunately released into the wild :( Stacktrace below if it helps

Fatal Exception: NSRangeException 0 CoreFoundation 0x207437518 exceptionPreprocess 1 libobjc.A.dylib 0x2066129f8 objc_exception_throw 2 CoreFoundation 0x2073b0f8c _CFArgv 3 CoreFoundation 0x207322f14 _CFDataInit 4 UIKitCore 0x23355b868 -[UIPickerView tableViewForColumn:] 5 UIKitCore 0x2335429a4 -[_UIDatePickerMode _isComponentScrolling:] 6 UIKitCore 0x233542b58 -[_UIDatePickerMode _shouldEnableValueForRow:column:] 7 UIKitCore 0x233542630 -[_UIDatePickerMode viewForRow:inComponent:reusingView:] 8 UIKitCore 0x23354dd44 -[_UIDatePickerView pickerView:viewForRow:forComponent:reusingView:] 9 UIKitCore 0x23355bde0 -[UIPickerView tableView:cellForRowAtIndexPath:] 10 UIKitCore 0x2335505a0 -[UIPickerColumnView tableView:cellForRowAtIndexPath:] 11 UIKitCore 0x2337daa38 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] 12 UIKitCore 0x2337daf38 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] 13 UIKitCore 0x2337a7740 -[UITableView _updateVisibleCellsNow:isRecursive:] 14 UIKitCore 0x2337b9f14 -[UITableView visibleCellsUsingPresentationValues:] 15 SkeletonView 0x104340a30 UITableView.subviewsToSkeleton.getter + 17 (SubviewsSkeletonables.swift:17) 16 SkeletonView 0x1043409b4 @objc UIView.subviewsSkeletonables.getter 17 SkeletonView 0x10434076c UIView.subviewsSkeletonables.getter + 7 (SubviewsSkeletonables.swift:7) 18 SkeletonView 0x1043409b4 @objc UIView.subviewsSkeletonables.getter 19 SkeletonView 0x104347f08 UIView.isSkeletonActive.getter + 13 (UIView+IBInspectable.swift:13) 20 SkeletonView 0x1043402b8 specialized UIView.skeletonTraitCollectionDidChange(:) + 103 (SkeletonView.swift:103) 21 SkeletonView 0x10433c704 @objc UIView.skeletonTraitCollectionDidChange(_:) () 22 UIKitCore 0x2339dc914 -[UIScrollView traitCollectionDidChange:] 23 UIKitCore 0x2337b15b4 -[UITableView traitCollectionDidChange:] 24 UIKitCore 0x233a2069c -[UIView _traitCollectionDidChangeInternal:] 25 UIKitCore 0x233a20768 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] 26 UIKitCore 0x233a20838 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] 27 UIKitCore 0x233a20838 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] 28 UIKitCore 0x23398facc -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] 29 UIKitCore 0x233a20a54 -[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:] 30 UIKitCore 0x233a32cf0 45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke 31 Foundation 0x207db1b34 -[NSISEngine withBehaviors:performModifications:] 32 UIKitCore 0x233a3298c -[UIView(Hierarchy) _postMovedFromSuperview:] 33 UIKitCore 0x233a41ddc -[UIView(Internal) _addSubview:positioned:relativeTo:] 34 UIKitCore 0x233559b04 30-[UIPickerView layoutSubviews]_block_invoke 35 UIKitCore 0x233a3a5d4 +[UIView(Animation) performWithoutAnimation:] 36 UIKitCore 0x233558ccc -[UIPickerView layoutSubviews] 37 UIKitCore 0x23354e068 -[_UIDatePickerView layoutSubviews] 38 UIKitCore 0x23355b6a8 -[UIPickerView selectedRowInComponent:] 39 UIKitCore 0x23355723c -[UIPickerView _updateSelectedRows] 40 UIKitCore 0x2335572e8 -[UIPickerView didMoveToWindow] 41 UIKitCore 0x233a3f444 -[UIView(Internal) _didMoveFromWindow:toWindow:] 42 UIKitCore 0x233a3f098 -[UIView(Internal) _didMoveFromWindow:toWindow:] 43 UIKitCore 0x23306a0d8 -[UIControl _didMoveFromWindow:toWindow:] 44 UIKitCore 0x233a32aa8 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke 45 Foundation 0x207db1b34 -[NSISEngine withBehaviors:performModifications:] 46 UIKitCore 0x233a3298c -[UIView(Hierarchy) _postMovedFromSuperview:] 47 UIKitCore 0x233a41ddc -[UIView(Internal) _addSubview:positioned:relativeTo:] 48 UIKitCore 0x2333d7798 -[UIInputWindowController changeToInputViewSet:] 49 UIKitCore 0x2333d8ad8 43-[UIInputWindowController setInputViewSet:]_block_invoke_4.1304 50 UIKitCore 0x2333d1520 -[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:] 51 UIKitCore 0x2333d8aa4 43-[UIInputWindowController setInputViewSet:]_block_invoke_3.1303 52 UIKitCore 0x2333caf9c -[UIInputWindowController performOperations:withTemplateNotificationInfo:] 53 UIKitCore 0x2333d87ac -[UIInputWindowController setInputViewSet:] 54 UIKitCore 0x2333d0f28 -[UIInputWindowController performOperations:withAnimationStyle:] 55 UIKitCore 0x23344a1d0 -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] 56 UIKitCore 0x233443780 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] 57 UIKitCore 0x2335ee6d8 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] 58 UIKitCore 0x2335ea3bc -[UIResponder becomeFirstResponder] 59 UIKitCore 0x233a32560 -[UIView(Hierarchy) becomeFirstResponder] 60 UIKitCore 0x23389be84 -[UITextField becomeFirstResponder] 61 UIKitCore 0x23385f8dc -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary] 62 UIKitCore 0x23384dd8c -[UITextSelectionInteraction oneFingerTap:] 63 UIKitCore 0x2331e8bcc -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] 64 UIKitCore 0x2331f0dd4 _UIGestureRecognizerSendTargetActions 65 UIKitCore 0x2331ee778 _UIGestureRecognizerSendActions 66 UIKitCore 0x2331edca4 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] 67 UIKitCore 0x2331e1d80 _UIGestureEnvironmentUpdate 68 UIKitCore 0x2331e14b0 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] 69 UIKitCore 0x2331e1290 -[UIGestureEnvironment _updateForEvent:window:] 70 UIKitCore 0x2335f94a8 -[UIWindow sendEvent:] 71 UIKitCore 0x2335d9534 -[UIApplication sendEvent:] 72 UIKitCore 0x23369f7c0 dispatchPreprocessedEventFromEventQueue 73 UIKitCore 0x2336a1eec handleEventQueueInternal 74 UIKitCore 0x23369b11c handleHIDEventFetcherDrain 75 CoreFoundation 0x2073c92bc CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION 76 CoreFoundation 0x2073c923c CFRunLoopDoSource0 77 CoreFoundation 0x2073c8b24 CFRunLoopDoSources0 78 CoreFoundation 0x2073c3a60 __CFRunLoopRun 79 CoreFoundation 0x2073c3354 CFRunLoopRunSpecific 80 GraphicsServices 0x2095c379c GSEventRunModal 81 UIKitCore 0x2335bfb68 UIApplicationMain 82 LandlordStudio 0x1021797ec main + 14 (main.m:14) 83 libdyld.dylib 0x206e898e0 start

minaMagedNaeem commented 4 years ago

I'm sorry its out of the issue context, but when I try installing 1.8.2 using this line ' ' ' pod 'SkeletonView', '~> 1.8.2' ' ' ' and pod install it installs 1.8.6 instead of 1.8.2 how can I get 1.8.2?

minaMagedNaeem commented 4 years ago

I figured it out, the line has to be pod 'SkeletonView', '1.8.2'

nunepradeepkumar commented 4 years ago

I am also facing same issue with DatePicker. Application is crashing.

nunepradeepkumar commented 4 years ago

The best solution for now used version 1.8.2 @byMohamedali

pod 'SkeletonView', '1.8.2' After i am instilling above pod also app is crashing. is there any alternate solution

BurhanDewantara commented 4 years ago

@Juanpe the bug exists on ios simulator 12.2 or for the device 12.3.1 (which is same according to this )

some of the stack trace are following,

Terminating app due to uncaught exception 'NSRangeException', reason: ' -[NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 0]' *** First throw call stack: ( 0 CoreFoundation 0x00000001132d86fb exceptionPreprocess + 331 1 libobjc.A.dylib 0x0000000112622ac5 objc_exception_throw + 48 2 CoreFoundation 0x0000000113226ddc _CFThrowFormattedException + 194 3 CoreFoundation 0x0000000113203312 -[__NSArrayM objectAtIndex:] + 178 4 UIKitCore 0x000000011cc90b00 -[UIPickerView tableViewForColumn:] + 61 5 UIKitCore 0x000000011cc76387 -[_UIDatePickerMode _isComponentScrolling:] + 57 6 UIKitCore 0x000000011cc76509 -[_UIDatePickerMode _shouldEnableValueForRow:column:] + 180 7 UIKitCore 0x000000011cc7604d -[_UIDatePickerMode viewForRow:inComponent:reusingView:] + 942 8 UIKitCore 0x000000011cc81c66 -[_UIDatePickerView pickerView:viewForRow:forComponent:reusingView:] + 60 9 UIKitCore 0x000000011cc9107c -[UIPickerView tableView:cellForRowAtIndexPath:] + 620

wsalim1610 commented 4 years ago

@Juanpe I mage a pull request that hopefully can fix this crash https://github.com/Juanpe/SkeletonView/pull/275

lazyvar commented 4 years ago

That PR fixed the issue for me.

michelleGerges commented 4 years ago

I have downgraded to 1.8.2 but the crash still exist any updates ?

trekirkman commented 4 years ago

Also experiencing this crash, and tried versions 1.8.2-1.8.6 to resolve. Steps to reproduce were similar: pushing date picker after skeleton view was already in view hierarchy.

After some investigation the crash occurs in SubviewsSkeletonables.swift line 17 when accessing visibleCells. Removing call to visibleCells resolved the crash, but unsure of best solution going forward.

lazyvar commented 4 years ago

@trekirkman The fix was merged to master, but not released. It is not in 1.8.6. I configured cocoapods to use the git URL as source rather than the version number tag. Not sure what's holding up a minor/patch bump.

Juanpe commented 4 years ago

Hi all, version 1.8.7 has been released :) sorry for the delay

RolandasRazma commented 4 years ago

can confirm 1.8.7 fixes crash

BrentMifsud commented 4 years ago

I am having this issue as well on 1.8.6. Will try updating to 1.8.7

michelleGerges commented 4 years ago

the crash not existing on 1.8.7

aksimomar commented 4 years ago

nop 1.8.2 to 1.8.7 still happening 1.8.1 is not happening I'm using iOS 11 (iOS 13 crash is not there for all versions tried 1.8.2- 1.8.3 - 1.8.6 - 1.8.7)

2020-07-01 18:47:56.323559+0100 Baims Stagging[34181:1043055] Terminating app due to uncaught exception 'NSRangeException', reason: ' -[NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]' *** First throw call stack: ( 0 CoreFoundation 0x00000001129b61cb exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000111ecaf41 objc_exception_throw + 48 2 CoreFoundation 0x00000001129f5e8c _CFThrowFormattedException + 194 3 CoreFoundation 0x00000001128e62cf -[NSArrayM objectAtIndex:] + 175 4 UIKit 0x000000010d645fb9 -[UIPickerView selectedRowInComponent:] + 76 5 UIKit 0x000000010e18feee -[_UIDatePickerMode _updateSelectedDateComponentsWithNewValueInComponent:usingSelectionBarValue:] + 732 6 UIKit 0x000000010e190217 -[_UIDatePickerMode selectedDateComponents] + 52 7 UIKit 0x000000010e1957e6 -[_UIDatePickerMode_DateAndTime _shouldEnableValueForRow:inComponent:calendarUnit:] + 100 8 UIKit 0x000000010e191409 -[_UIDatePickerMode _shouldEnableValueForRow:column:] + 68 9 UIKit 0x000000010e190f9f -[_UIDatePickerMode viewForRow:inComponent:reusingView:] + 956 10 UIKit 0x000000010e195af2 -[_UIDatePickerMode_DateAndTime viewForRow:inComponent:reusingView:] + 206 11 UIKit 0x000000010e183909 -[_UIDatePickerView pickerView:viewForRow:forComponent:reusingView:] + 60 12 UIKit 0x000000010d6466f6 -[UIPickerView tableView:cellForRowAtIndexPath:] + 621 13 UIKit 0x000000010e16d958 -[UIPickerColumnView tableView:cellForRowAtIndexPath:] + 168 14 UIKit 0x000000010d7c0b99 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 778 15 UIKit 0x000000010d7c113f -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74 16 UIKit 0x000000010d787344 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2892 17 UIKit 0x000000010d79ceed -[UITableView _visibleCellsUsingPresentationValues:] + 514 18 SkeletonView 0x000000010cda1423 $sSo11UITableViewC08SkeletonB0E010subviewsToC0SaySo6UIViewCGvg + 35 19 SkeletonView 0x000000010cda13b5 $sSo11UITableViewC08SkeletonB0E010subviewsToC0SaySo6UIViewCGvgTo + 53 20 SkeletonView 0x000000010cda10d6 $sSo6UIViewC12SkeletonViewE21subviewsSkeletonablesSayABGvg + 54 21 SkeletonView 0x000000010cda1055 $sSo6UIViewC12SkeletonViewE21subviewsSkeletonablesSayABGvgTo + 53 22 SkeletonView 0x000000010cdb2b9c $sSo6UIViewC12SkeletonViewE02isB6ActiveSbvg + 172 23 SkeletonView 0x000000010cd9e113 $sSo6UIViewC12SkeletonViewE32skeletonTraitCollectionDidChangeyySo07UITraitF0CSgF + 131 24 SkeletonView 0x000000010cd9e1e4 $sSo6UIViewC12SkeletonViewE32skeletonTraitCollectionDidChangeyySo07UITraitF0CSgFTo + 68 25 UIKit 0x000000010d753b88 -[UIScrollView traitCollectionDidChange:] + 73 26 UIKit 0x000000010d792d2c -[UITableView traitCollectionDidChange:] + 74 27 UIKit 0x000000010d706c3c -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 163 28 UIKit 0x000000010d706d38 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 415 29 UIKit 0x000000010d706d38 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 415 30 UIKit 0x000000010e1d57eb -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 104 31 UIKit 0x000000010d706ff3 -[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:] + 151 32 UIKit 0x000000010d71b1b0 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 767 33 Foundation 0x000000010a950de1 -[NSISEngine withBehaviors:performModifications:] + 131 34 UIKit 0x000000010d71ae4a -[UIView(Hierarchy) _postMovedFromSuperview:] + 855 35 UIKit 0x000000010d72b749 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973 36 UIKit 0x000000010d643c3a 30-[UIPickerView layoutSubviews]_block_invoke + 5377 37 UIKit 0x000000010d7236ec +[UIView(Animation) performWithoutAnimation:] + 90 38 UIKit 0x000000010d6426fb -[UIPickerView layoutSubviews] + 159 39 UIKit 0x000000010e183c48 -[_UIDatePickerView layoutSubviews] + 103 40 UIKit 0x000000010d645f9a -[UIPickerView selectedRowInComponent:] + 45 41 UIKit 0x000000010d640c0c -[UIPickerView _updateSelectedRows] + 143 42 UIKit 0x000000010d640ca6 -[UIPickerView didMoveToWindow] + 101 43 UIKit 0x000000010d728bd3 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1748 44 UIKit 0x000000010d728810 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 785 45 UIKit 0x000000010d7df67a -[UIControl _didMoveFromWindow:toWindow:] + 67 46 UIKit 0x000000010d71af48 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 151 47 Foundation 0x000000010a950de1 -[NSISEngine withBehaviors:performModifications:] + 131 48 UIKit 0x000000010d71ae4a -[UIView(Hierarchy) _postMovedFromSuperview:] + 855 49 UIKit 0x000000010d72b749 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1973 50 UIKit 0x000000010e2b86a2 -[UIInputWindowController changeToInputViewSet:] + 597 51 UIKit 0x000000010e2b97f4 43-[UIInputWindowController setInputViewSet:]_block_invoke + 57 52 UIKit 0x000000010d7236ec +[UIView(Animation) performWithoutAnimation:] + 90 53 UIKit 0x000000010e2b952f -[UIInputWindowController setInputViewSet:] + 702 54 UIKit 0x000000010e2b09d1 -[UIInputWindowController performOperations:withAnimationStyle:] + 50 55 UIKit 0x000000010de51f9e -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 1081 56 UIKit 0x000000010d894acd -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 81 57 UIKit 0x000000010e379cc7 -[UITextField becomeFirstResponder] + 690 58 UIKit 0x000000010dc6b960 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) setFirstResponderIfNecessary] + 208 59 UIKit 0x000000010dc3c159 -[UITextGestureClusterSelection oneFingerTap:] + 3845 60 UIKit 0x000000010dc5aefb -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57 61 UIKit 0x000000010dc63d83 _UIGestureRecognizerSendTargetActions + 109 62 UIKit 0x000000010dc6162e _UIGestureRecognizerSendActions + 307 63 UIKit 0x000000010dc6089a -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 1002 64 UIKit 0x000000010dc45bfd _UIGestureEnvironmentUpdate + 1306 65 UIKit 0x000000010dc45697 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 484 66 UIKit 0x000000010dc44743 -[UIGestureEnvironment _updateGesturesForEvent:window:] + 288 67 UIKit 0x000000010d6da228 -[UIWindow sendEvent:] + 4102 68 UIKit 0x000000010d67dd96 -[UIApplication sendEvent:] + 352 69 UIKit 0x000000010dfbffce dispatchPreprocessedEventFromEventQueue + 2809 70 UIKit 0x000000010dfc2c23 handleEventQueueInternal + 5957 71 CoreFoundation 0x00000001129592b1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 72 CoreFoundation 0x00000001129f8d31 CFRunLoopDoSource0 + 81 73 CoreFoundation 0x000000011293dc19 CFRunLoopDoSources0 + 185 74 CoreFoundation 0x000000011293d1ff CFRunLoopRun + 1279 75 CoreFoundation 0x000000011293ca89 CFRunLoopRunSpecific + 409 76 GraphicsServices 0x000000011577c9c6 GSEventRunModal + 62 77 UIKit 0x000000010d66123c UIApplicationMain + 159 78 Baims Stagging 0x00000001074a74db main + 75 79 libdyld.dylib 0x0000000113ca5d81 start + 1 80 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

vladyslavsosiuk commented 4 years ago

Same crash for iOS 12.4 (iOS 13+ is fine). Tried 1.9.0 version

vladyslavsosiuk commented 4 years ago

Possible workaround: https://github.com/vladislavsosiuk/SkeletonView/commit/b7bf3903b769c311e4bd31758dec224fee3f7579

Juanpe commented 3 years ago

Hi guys, I noticed that this issue is solved in the latest version (1.23.0).

You can check it using the provided sample project. SkeletonCrash_Fixed.zip

https://user-images.githubusercontent.com/1409041/130047742-6701efb2-5824-499d-a1bb-9c854e5f0aaa.mp4

I'm going to close this issue. Feel free to reopen it :)