Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on proxy method "setContentOffset" #74

Open
andymedvedev opened this issue Sep 18, 2018 · 4 comments
Open

Crash on proxy method "setContentOffset" #74

andymedvedev opened this issue Sep 18, 2018 · 4 comments

Comments

@andymedvedev
Copy link

andymedvedev commented Sep 18, 2018

Hello, i cant reproduce constantly crash but sometimes it happens and i dont know why. It start crashing after we add library to project. I make exception breakpoint and it shows that it crashes on swizzled method pb_setContentOffset:

2018-09-14 15:22:30.361572+0700 TestApp[78861:15083844] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILayoutGuide nsli_engineToUserScalingCoefficients]: unrecognized selector sent to instance 0x6040005bf3a0'

First throw call stack:
(
0 CoreFoundation 0x0000000110a881e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x000000010fcd4031 objc_exception_throw + 48
2 CoreFoundation 0x0000000110b09784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 UIKit 0x000000010e31f0e2 -[UILayoutGuide forwardInvocation:] + 95
4 CoreFoundation 0x0000000110a0a5f8 __forwarding__ + 760
5 CoreFoundation 0x0000000110a0a278 _CF_forwarding_prep_0 + 120
6 Foundation 0x000000010f83d7b1 -[NSLayoutAnchor nsli_lowerIntoExpression:withCoefficient:forConstraint:] + 275
7 Foundation 0x000000010f7029a5 -[NSLayoutConstraint _lowerIntoExpression:reportingConstantIsRounded:] + 99
8 Foundation 0x000000010f707fc0 -[NSLayoutConstraint _containerGeometryDidChange] + 88
9 UIKit 0x000000010d58c10b -[UIView(Geometry) setBounds:] + 2516
10 UIKit 0x000000010d5b58aa -[UIScrollView setBounds:] + 1140
11 UIKit 0x000000010d5b6b09 -[UIScrollView setContentOffset:] + 438
12 UIScrollView_InfiniteScroll 0x000000010f6716ef -[UIScrollView(InfiniteScroll) pb_setContentOffset:] + 63
13 UIKit 0x000000010d5d9a83 -[UIScrollView(UIScrollViewInternal) _adjustContentOffsetIfNecessary] + 53
14 UIKit 0x000000010d5d2cd0 -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:tramplingDragFlags:] + 462
15 UIKit 0x000000010d5b8565 -[UIScrollView removeFromSuperview] + 32
16 UIKit 0x000000010d577c07 -[UIView dealloc] + 508
17 UIKit 0x000000010d67947c -[UIViewController dealloc] + 665
18 CoreFoundation 0x00000001109c03dd -[__NSArrayI dealloc] + 61
19 libobjc.A.dylib 0x000000010fce8a6e _ZN11objc_object17sidetable_releaseEb + 202
20 UIKit 0x000000010d6ac398 _destroy_helper_block.538 + 31
21 libsystem_blocks.dylib 0x00000001131f998a _Block_release + 111
22 libsystem_blocks.dylib 0x00000001131f998a _Block_release + 111
23 UIKit 0x000000010d6c3976 _destroy_helper_block.1809 + 19
24 libsystem_blocks.dylib 0x00000001131f998a _Block_release + 111
25 UIKit 0x000000010d6c58d9 -[UINavigationController _startDeferredTransitionIfNeeded:] + 1569
26 UIKit 0x000000010d6c686c -[UINavigationController __viewWillLayoutSubviews] + 150
27 UIKit 0x000000010d91ed0b -[UILayoutContainerView layoutSubviews] + 231
28 UIKit 0x000000010d5a87a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1515
29 QuartzCore 0x000000011197b456 -[CALayer layoutSublayers] + 177
30 QuartzCore 0x000000011197f667 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
31 QuartzCore 0x00000001119060fb _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
32 QuartzCore 0x000000011193379c _ZN2CA11Transaction6commitEv + 568
33 UIKit 0x000000010d4d32ef _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
34 UIKit 0x000000010de38662 __handleEventQueueInternal + 6875
35 CoreFoundation 0x0000000110a2abb1 _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17
36 CoreFoundation 0x0000000110a0f4af __CFRunLoopDoSources0 + 271
37 CoreFoundation 0x0000000110a0ea6f __CFRunLoopRun + 1263
38 CoreFoundation 0x0000000110a0e30b CFRunLoopRunSpecific + 635
39 GraphicsServices 0x000000011792ba73 GSEventRunModal + 62
40 UIKit 0x000000010d4d9057 UIApplicationMain + 159
41 Betolimp 0x000000010b924e57 main + 55
42 libdyld.dylib 0x0000000113187955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException```
@pronebird
Copy link
Owner

Hi 👋, seems like autolayout pass happens during removeFromSuperview.

My guess is that you popped the controller from navigation stack with decelerating scroll view.

Perhaps the swizzled method should be guarded from causing layout changes when the scroll view is about to be removed from the superview.

@andymedvedev
Copy link
Author

Thanks for quick answer! You helped me very much!

@pronebird
Copy link
Owner

@andertsk did you find out what was the exact issue?

@andymedvedev
Copy link
Author

@pronebird yeah you was almost right. I pop controller and on the other hand make setContentOffset call. That was my problem. Now i totally clear my code and romve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants