nicklockwood / layout

A declarative UI framework for iOS
MIT License
2.23k stars 97 forks source link

Crashing after updating to 0.6.32 #151

Closed rachel-13 closed 5 years ago

rachel-13 commented 5 years ago

Hi,

I am getting the following error after updating to 0.6.32. I ran my project on iOS 12 simulator. Our app supports down to iOS 9. Could it be our min supported version giving us this error?

[_UIButtonBarStackView layout_intrinsicContentSize]: unrecognized selector sent to instance 0x7ffed57036f0
2018-10-17 19:27:05.576194+0800 photobook[45429:5278405] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UIButtonBarStackView layout_intrinsicContentSize]: unrecognized selector sent to instance 0x7ffed57036f0'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000108df229b __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x000000010838e735 objc_exception_throw + 48
    2   CoreFoundation                      0x0000000108e10fa4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   UIKitCore                           0x000000010f945163 -[UIResponder doesNotRecognizeSelector:] + 287
    4   CoreFoundation                      0x0000000108df6fb6 ___forwarding___ + 1446
    5   CoreFoundation                      0x0000000108df8e88 _CF_forwarding_prep_0 + 120
    6   Layout                              0x0000000106ba99df $SSo20UICollectionViewCellC6LayoutE27layout_intrinsicContentSize33_E820540BA7B1A5B68DC346B3C080A81DLLSo6CGSizeVvg + 287
    7   Layout                              0x0000000106ba988e $SSo16UICollectionViewC6LayoutE27layout_intrinsicContentSize33_E820540BA7B1A5B68DC346B3C080A81DLLSo6CGSizeVvgToTm + 30
    8   UIKitCore                           0x000000010f43b9c9 -[UIView(UIConstraintBasedLayout) _generateContentSizeConstraints] + 35
    9   UIKitCore                           0x000000010f43b61a -[UIView(UIConstraintBasedLayout) _updateContentSizeConstraints] + 257
    10  UIKitCore                           0x000000010f446902 -[UIView(AdditionalLayoutSupport) _updateSystemConstraints] + 99
    11  UIKitCore                           0x000000010fa12fb5 __32-[UIStackView updateConstraints]_block_invoke + 46
    12  UIKitCore                           0x000000010f444876 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 104
    13  UIKitCore                           0x000000010fa12f81 -[UIStackView updateConstraints] + 70
    14  UIKitCore                           0x000000010f5cf23f -[_UIButtonBarStackView updateConstraints] + 87
    15  UIKitCore                           0x000000010f445254 -[UIView(AdditionalLayoutSupport) _sendUpdateConstraintsIfNecessaryForSecondPass:] + 161
    16  UIKitCore                           0x000000010f445829 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 1245
    17  UIKitCore                           0x000000010f4456ad -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 865
    18  Foundation                          0x0000000107f9c55a -[NSISEngine withBehaviors:performModifications:] + 110
    19  UIKitCore                           0x000000010f445a83 -[UIView(AdditionalLayoutSupport) _recursiveUpdateConstraintsIfNeededCollectingViews:forSecondPass:] + 112
    20  UIKitCore                           0x000000010f4456ad -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededCollectingViews:forSecondPass:] + 865
    21  UIKitCore                           0x000000010f446046 __100-[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:]_block_invoke + 85
    22  UIKitCore                           0x000000010f445bce -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededWithViewForVariableChangeNotifications:] + 155
    23  UIKitCore                           0x000000010f446c82 -[UIView(AdditionalLayoutSupport) _updateConstraintsAtEngineLevelIfNeededWithViewForVariableChangeNotifications:] + 374
    24  UIKitCore                           0x000000010fc621eb -[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 242
    25  UIKitCore                           0x000000010fc77069 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1525
    26  UIKitCore                           0x000000010f823474 -[UINavigationBar layoutSublayersOfLayer:] + 248
    27  QuartzCore                          0x000000010a755d3d -[CALayer layoutSublayers] + 175
    28  QuartzCore                          0x000000010a75abf7 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
    29  UIKitCore                           0x000000010fc618f4 -[UIView(Hierarchy) layoutBelowIfNeeded] + 1429
    30  UIKitCore                           0x000000010f836153 -[UINavigationController _positionNavigationBarHidden:edge:initialOffset:] + 800
    31  UIKitCore                           0x000000010f8363f0 -[UINavigationController _positionNavigationBarHidden:edge:] + 388
    32  UIKitCore                           0x000000010f84abfd -[UINavigationController __viewWillLayoutSubviews] + 231
    33  UIKitCore                           0x000000010f7d663f -[UILayoutContainerView layoutSubviews] + 217
    34  UIKitCore                           0x000000010fc77015 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1441
    35  QuartzCore                          0x000000010a755d3d -[CALayer layoutSublayers] + 175
    36  QuartzCore                          0x000000010a75abf7 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
    37  QuartzCore                          0x000000010a6d3aa6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 342
    38  QuartzCore                          0x000000010a70ac2a _ZN2CA11Transaction6commitEv + 576
    39  UIKitCore                           0x000000010f578d4c __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 139
    40  CoreFoundation                      0x0000000108d55a3c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    41  CoreFoundation                      0x0000000108d551f0 __CFRunLoopDoBlocks + 336
    42  CoreFoundation                      0x0000000108d4fa64 __CFRunLoopRun + 1284
    43  CoreFoundation                      0x0000000108d4f221 CFRunLoopRunSpecific + 625
    44  GraphicsServices                    0x0000000112e051dd GSEventRunModal + 62
    45  UIKitCore                           0x000000010f55e115 UIApplicationMain + 140
    46  photobook                           0x0000000103d25fd4 main + 68
    47  libdyld.dylib                       0x000000010c2e9551 start + 1
    48  ???                                 0x0000000000000001 0x0 + 1
nicklockwood commented 5 years ago

@rachel-13 this looks like a bug introduced in the latest release. I'll investigate and get back to you.

It might be worth reverting to 0.6.30 or 0.6.31 in the meantime if those versions weren't causing any issues for you on iOS 12.

nicklockwood commented 5 years ago

@rachel-13 do you have a sample project I can use to reproduce this? I'm struggling to see what might be causing it.

nicklockwood commented 5 years ago

@rachel-13 is it possible that this crash was happening with version 0.6.31 and not 0.6.32?

rachel-13 commented 5 years ago

Hi @nicklockwood,

0.6.30 is works fine and there are no crashes. I just built my project with 0.6.31 and can confirm it is still crashing but on this version I didn't get a crashlog but rather my project keeps stopping at the following function.

extension NSObject {
    var _layoutNode: LayoutNode? {
        return objc_getAssociatedObject(self, &layoutNodeKey) as? LayoutNode
    }
}
nicklockwood commented 5 years ago

@rachel-13 I think I may have found the issue. Can you check the latest release (0.6.34) and see if it's solved your crash?

rachel-13 commented 5 years ago

I will get the team to take a look at this update. Thanks @nicklockwood

momamene commented 5 years ago

I've also got the same error after updating to 0.6.32, which was not occured in 0.6.30. unrecognized selector sent to instance error was solved when I updated to 0.6.34.

But the another error occurred when I'm using UICollectionView. It seems that there are infinite loop in UICollectionView. layout_intrinsicContentSize after calling collectionView.dequeueReusableCellNode. I've attatched errorlogs.txt. I hope it will be helpful to find a bug. Thank much.

nicklockwood commented 5 years ago

@momamene sorry, that was missed in the previous fix. I've pushed another update (0.6.35) that should solve it.

momamene commented 5 years ago

Fixed! Thank you so much! Layout would be the best UI framework in all of iOS projects.