TextureGroup / Texture

Smooth asynchronous user interfaces for iOS apps.
https://texturegroup.org/
Other
8.02k stars 1.29k forks source link

Exception from using 'shouldShowRangeDebugOverlay' #486

Open dklinzh opened 7 years ago

dklinzh commented 7 years ago

I knew property shouldShowRangeDebugOverlay is only for debug purpose. Then I turn it on in AppDelegate of the example project AsyncDisplayKitOverview likes below:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    ASDisplayNode.shouldShowRangeDebugOverlay = YES;

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[OverviewComponentsViewController new]];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    [[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:47/255.0 green:184/255.0 blue:253/255.0 alpha:1.0]];
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];;

    return YES;
}

But it only works fine with the viewControllers related to ASRangeController, such as OverviewASCollectionNode, OverviewASTableNode, OverviewASPagerNode. Otherwise, It would occur an exception when push to a simple ASViewController/UIViewController from OverviewComponentsViewController with ASTableNode. So I think it would restrict the use of this feature in development . Can anyone help me? THX Logs:

2017-07-31 13:38:11.398 Sample[29368:11315454] *** Assertion failure in -[ASImageNode setFrame:], /Users/dklinzh/Documents/iOS/Framework/Texture/Source/Private/ASDisplayNode+UIViewBridge.mm:314
2017-07-31 13:38:11.413 Sample[29368:11315454] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[ASDisplayNode setFrame:] - The new frame ({{nan, 11}, {nan, 9}}) is invalid and unsafe to be set.'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010d88cb0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x000000010cf81141 objc_exception_throw + 48
    2   CoreFoundation                      0x000000010d890cf2 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x000000010a61f536 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
    4   Sample                              0x0000000109f8de26 -[ASDisplayNode(UIViewBridge) setFrame:] + 1894
    5   Sample                              0x000000010a126347 __38-[_ASRangeDebugBarView layoutSubviews]_block_invoke + 183
    6   UIKit                               0x000000010b21d3da +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 572
    7   UIKit                               0x000000010b21d8dd +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 99
    8   Sample                              0x000000010a12538c -[_ASRangeDebugBarView layoutSubviews] + 2508
    9   UIKit                               0x000000010b22755b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1268
    10  QuartzCore                          0x000000010e9ee904 -[CALayer layoutSublayers] + 146
    11  QuartzCore                          0x000000010e9e2526 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 370
    12  QuartzCore                          0x000000010e9e23a0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    13  QuartzCore                          0x000000010e971e92 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
    14  QuartzCore                          0x000000010e99e130 _ZN2CA11Transaction6commitEv + 468
    15  UIKit                               0x000000010b15d367 _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
    16  UIKit                               0x000000010b95e7a3 __handleEventQueue + 5843
    17  CoreFoundation                      0x000000010d832c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    18  CoreFoundation                      0x000000010d8180cf __CFRunLoopDoSources0 + 527
    19  CoreFoundation                      0x000000010d8175ff __CFRunLoopRun + 911
    20  CoreFoundation                      0x000000010d817016 CFRunLoopRunSpecific + 406
    21  GraphicsServices                    0x0000000111b7aa24 GSEventRunModal + 62
    22  UIKit                               0x000000010b164134 UIApplicationMain + 159
    23  Sample                              0x0000000109e6786f main + 111
    24  libdyld.dylib                       0x000000010ebc465d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
liaoyuanng commented 5 years ago

same issue.

duxinfeng commented 5 years ago

me too.

'Texture', '~> 2.6'

ASDisplayNode.shouldShowRangeDebugOverlay = YES;

When the App goes back to the foreground from the background.

Delete ASDisplayNode.shouldShowRangeDebugOverlay = YES; no problem。

crash log

[ASDisplayNode setFrame:] - The new frame ({{nan, 11}, {nan, 9}}) is invalid and unsafe to be set.
(null)
((
    0   CoreFoundation                      0x00000001127de1bb __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x00000001176be735 objc_exception_throw + 48
    2   CoreFoundation                      0x00000001127ddf42 +[NSException raise:format:arguments:] + 98
    3   Foundation                          0x0000000113ddc877 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
    4   AsyncDisplayKit                     0x00000001113e7d90 -[ASDisplayNode(UIViewBridge) setFrame:] + 1904
    5   AsyncDisplayKit                     0x000000011158c061 __38-[_ASRangeDebugBarView layoutSubviews]_block_invoke + 177
    6   UIKitCore                           0x000000011e986bf2 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 558
    7   UIKitCore                           0x000000011e9870cf +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 99
    8   AsyncDisplayKit                     0x000000011158afc6 -[_ASRangeDebugBarView layoutSubviews] + 2518
    9   UIKitCore                           0x000000011e993795 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1441
    10  QuartzCore                          0x000000011597db19 -[CALayer layoutSublayers] + 175
    11  QuartzCore                          0x00000001159829d3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
    12  QuartzCore                          0x00000001158fb7ca _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 342
    13  QuartzCore                          0x000000011593297e _ZN2CA11Transaction6commitEv + 576
    14  UIKitCore                           0x000000011e4c42d0 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 139
    15  CoreFoundation                      0x000000011274362c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    16  CoreFoundation                      0x0000000112742de0 __CFRunLoopDoBlocks + 336
    17  CoreFoundation                      0x000000011273d654 __CFRunLoopRun + 1284
    18  CoreFoundation                      0x000000011273ce11 CFRunLoopRunSpecific + 625
    19  GraphicsServices                    0x000000011af801dd GSEventRunModal + 62
    20  UIKitCore                           0x000000011e4a981d UIApplicationMain + 140
    21                                             0x000000010f33f6d0 main + 112
    22  libdyld.dylib                       0x0000000118c91575 start + 1
)
harryzjm commented 4 years ago

I have close Enable Foundation Assertions in Build Settings, and it works.