crash with NSLayoutConstraintIsPotentiallyDanglyInContainer

Hi

I have get crash with my App

Xcode 11.4.1

Code Type:ARM-64 (Native)

OS 13.1 13.3. 13.4 etc.

Device iPhone 8 plus iPhone x etc.

I can't reproduce the crash

Is there anyone get the same problem


Exception Type: EXC_BAD_ACCESS (SIGSEGV)

Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000010706038

VM Region Info: 0x10706038 is not in any region. Bytes before following region: 4023164872

REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL

UNUSED SPACE AT START


Thread 0 Crashed:

0 libobjc.A.dylib 0x00000001a5b60fb0 objc_msgSend + 16

1 Foundation 0x00000001a6347fd8 NSLayoutConstraintIsPotentiallyDanglyInContainer + 116 (NSLayoutConstraint.m:2251)

2 UIKitCore 0x00000001aa330804 -[UIView(AdditionalLayoutSupport) _snipDangliesWithForce:repairIfPossibleForViewThatMoved:newSupe... + 456 (NSLayoutConstraint_UIKitAdditions.m:5488)

3 UIKitCore 0x00000001aa33058c _UIViewRemoveConstraintsMadeDanglyByChangingSuperview + 968 (NSLayoutConstraint_UIKitAdditions.m:5433)

4 UIKitCore 0x00000001aa3eadd8 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 52 (UIView.m:11527)

5 Foundation 0x00000001a612785c -[NSISEngine withBehaviors:performModifications:] + 88 (NSISEngine.m:1917)

6 UIKitCore 0x00000001aa3ead34 -[UIView(Hierarchy) _postMovedFromSuperview:] + 808 (UIView.m:435)

7 UIKitCore 0x00000001aa3e8f90 __UIViewWasRemovedFromSuperview + 176 (UIView.m:10910)

8 UIKitCore 0x00000001aa3e8a64 -[UIView(Hierarchy) removeFromSuperview] + 384 (UIView.m:10962)

9 HappyTravelFangTe 0x000000010085b1b4 0x1003d0000 + 4764084

10 UIKitCore 0x00000001aa3f3f60 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 600 (UIView.m:14023)

11 UIKitCore 0x00000001aa3c6bd8 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 248 (UIView.m:0)

12 UIKitCore 0x00000001aa3c7100 -[UIViewAnimationState animationDidStop:finished:] + 248 (UIView.m:2219)

13 QuartzCore 0x00000001aca29e38 CA::Layer::run_animation_callbacks(void*) + 280 (CALayer.mm:6832)

14 libdispatch.dylib 0x00000001a5af1fd8 _dispatch_client_callout + 20 (object.m:495)

15 libdispatch.dylib 0x00000001a5afdcc8 _dispatch_main_queue_callback_4CF + 968 (inline_internal.h:2484)

16 CoreFoundation 0x00000001a5dc7cc8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1749)

17 CoreFoundation 0x00000001a5dc2a24 __CFRunLoopRun + 1980 (CFRunLoop.c:3069)

18 CoreFoundation 0x00000001a5dc1f40 CFRunLoopRunSpecific + 480 (CFRunLoop.c:3192)

19 GraphicsServices 0x00000001b0052534 GSEventRunModal + 108 (GSEvent.c:2246)

20 UIKitCore 0x00000001a9f4d580 UIApplicationMain + 1940 (UIApplication.m:4773)

21 HappyTravelFangTe 0x000000010081a1fc 0x1003d0000 + 4497916

22 libdyld.dylib 0x00000001a5c40e18 start + 4

In the context of layout constraints, dangly means that the constraint involves a view not within of subtree of the view to which the constraint was applied. This isn’t a showstopper in and of itself, but the fact you’re seeing a crash here suggests that something has gone wrong with your view management.

Most crashes in

objc_msgSend
are the result of a memory management problem. For example, if you over release an object, it can be deallocated out from underneath some part of the system. If that then tries to call the object, you can crash like this.

A good first step here is to apply the Standard Memory Debugging Tools. These can help to flush out such hard-to-reproduce memory management problems.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
crash with NSLayoutConstraintIsPotentiallyDanglyInContainer
 
 
Q