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

Impossible to set up layout with view hierarchy unprepared for constraint. #253

Closed
amaurydavid opened this issue Oct 24, 2018 · 2 comments
Closed

Comments

@amaurydavid
Copy link

amaurydavid commented Oct 24, 2018

Hello =)

I'm using SwiftMessages 4.1.4 in a production app and the app happen to crash (the iOS version seems to be irrelevant as it impacts iOS 9 to 12) for some users when presenting a SwiftMessage.
Almost all crashes happen when the app is in foreground.
Here is the stack:

Fatal Exception: NSInternalInconsistencyException
Impossible to set up layout with view hierarchy unprepared for constraint.
0  CoreFoundation                 0x1835a2d8c __exceptionPreprocess
1  libobjc.A.dylib                0x18275c5ec objc_exception_throw
2  CoreFoundation                 0x1835a2bf8 +[NSException raise:format:]
3  Foundation                     0x183f92fa0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4  UIKit                          0x18dcd1f78 __120-[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:]_block_invoke_2
5  UIKit                          0x18d1c29ec -[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:]
6  UIKit                          0x18d1c2804 -[UIView(UIConstraintBasedLayout) _tryToAddConstraintWithoutUpdatingConstraintsArray:roundingAdjustment:mutuallyExclusiveConstraints:]
7  UIKit                          0x18d4b1254 __50-[UIView(UIConstraintBasedLayout) addConstraints:]_block_invoke
8  Foundation                     0x183ef1500 -[NSISEngine withBehaviors:performModifications:]
9  UIKit                          0x18d2670cc -[UIView(UIConstraintBasedLayout) addConstraints:]
10 SwiftMessages                  0x104e08dac specialized installMaskingView #1 (containerView:) in Presenter.install() (Presenter.swift:344)
11 SwiftMessages                  0x104e065d0 Presenter.install() (Presenter.swift)
12 SwiftMessages                  0x104e097e4 specialized Presenter.show(completion:) (Presenter.swift:116)
13 SwiftMessages                  0x104e0c3b8 closure #1 in SwiftMessages.dequeueNext() (SwiftMessages.swift:539)
14 SwiftMessages                  0x104e19088 _T0Ieg_IeyB_TR (TopBottomAnimation.swift)
15 libdispatch.dylib              0x182e94aa0 _dispatch_call_block_and_release
16 libdispatch.dylib              0x182e94a60 _dispatch_client_callout
17 libdispatch.dylib              0x182ea165c _dispatch_main_queue_callback_4CF$VARIANT$mp
18 CoreFoundation                 0x18354b070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
19 CoreFoundation                 0x183548bc8 __CFRunLoopRun
20 CoreFoundation                 0x183468da8 CFRunLoopRunSpecific
21 GraphicsServices               0x18544e020 GSEventRunModal
22 UIKit                          0x18d488758 UIApplicationMain
23 MyApp                          0x1026ff028 main (AppDelegate.swift:28)
24 libdyld.dylib                  0x182ef9fc0 start

The app shows various messages at various times but the stacktrace and error message are always the same ones.
To help fixing this crash, i've decided to focus on a particular message, which only presented in UITabBarController's viewDidAppear.
As the stacktrace doesn't mention any UITabBarController, I suppose that at the time of the crash, the message wasn't presenting from the viewDidAppear and I suspect that there is some shady (to me) SwiftMessage's internal process at work here.

Could you help me on this one?

@amaurydavid
Copy link
Author

amaurydavid commented Nov 12, 2018

Still no one? :(

@wtmoose
Copy link
Member

wtmoose commented Nov 14, 2018

I'll take a look if you get on 6.x and still have a problem. I don't have time to support old versions.

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