Can anyone help me diagnose this crash. It happens in the animation block on the layoutIfNeeded() function call. Full function and crash report attached. It seems to be related to memory but I can't pin it down.
private func showWarningView() {
DispatchQueue.main.async { [weak self] in
guard let strongSelf = self else { return }
if let safeAreaHeight = strongSelf.superview?.safeAreaLayoutGuide.layoutFrame.size.height {
let visibleBannerHeight: CGFloat = strongSelf.isBannerVisible ? strongSelf.bannerHeight : 0
let newConstraintConstant = (safeAreaHeight - strongSelf.externalBottomOffset - visibleBannerHeight) - strongSelf.warningBannerHeight
strongSelf.addInternalBottomOffset(with: strongSelf.warningBannerHeight)
strongSelf.warningViewTopConstraint.constant = newConstraintConstant
}
strongSelf.isWarningViewVisible = true
let showWarningView = UIViewPropertyAnimator(duration: 0.25, curve: .easeIn, animations: {
self?.layoutIfNeeded() // <---- Crash Happens here
})
showWarningView.startAnimation()
}
}
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010 Exception Codes: 0x0000000000000001, 0x0000000000000010 VM Region Info: 0x10 is not in any region. Bytes before following region: 4337303536
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102860000-102864000 [ 16K] r-x/r-x SM=COW ... Exception Note: EXC_CORPSE_NOTIFY Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [265]
Triggered by Thread: 0
Kernel Triage: VM - Compressor failed a blocking pager_get
Thread 0 name: Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001d5d22f40 objc_msgSend + 32
1 UIKitCore 0x00000001bf72d010 -[UIView(AdditionalLayoutSupport) _nsis_center:bounds:inEngine:forLayoutGuide:] + 112 (NSLayoutConstraint_UIKitAdditions.m:3513)
2 UIKitCore 0x00000001bf7455b0 -[UILayoutGuide _updateLayoutFrameInOwningView:fromEngine:] + 80 (UILayoutGuide.m:109)
3 UIKitCore 0x00000001bf6c8350 -[UIView(AdditionalLayoutSupport) _is_layout] + 320 (NSLayoutConstraint_UIKitAdditions.m:3173)
4 UIKitCore 0x00000001bf5b1a7c -[UIView _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 1028 (UIView.m:12933)
5 UIKitCore 0x00000001bf5a9fb4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2592 (UIView.m:18426)
6 QuartzCore 0x00000001c0d20cd0 CA::Layer::layout_if_needed(CA::Transaction*) + 532 (CALayer.mm:10116)
7 UIKitCore 0x00000001bf60dd90 -[UIView(Hierarchy) layoutBelowIfNeeded] + 584 (UIView.m:12868)
8 ****** 0x0000000102eb59d4 closure #1 in closure #1 in BottomDrawView.showWarningView() + 52 (BottomDrawView.swift:410)
9 ****** 0x0000000102eb59d4 partial apply for closure #1 in closure #1 in BottomDrawView.showWarningView() + 68 (:0)
10 ****** 0x0000000102f33378 thunk for @escaping @callee_guaranteed () -> () + 20 (:0)
11 UIKitCore 0x00000001bf8ee77c -[UIViewPropertyAnimator _runAnimations] + 212 (UIViewPropertyAnimator.m:1912)
12 UIKitCore 0x00000001bf78c6a4 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke_2 + 108 (UIViewPropertyAnimator.m:3279)
13 UIKitCore 0x00000001bf637fec __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke + 128 (UIViewPropertyAnimator.m:3267)
14 UIKitCore 0x00000001bfb6eba8 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke.1142 + 284 (UIViewPropertyAnimator.m:3276)
15 UIKitCore 0x00000001bf95fa20 -[UIViewPropertyAnimator _setupAnimationTracking:] + 132 (UIViewPropertyAnimator.m:3230)
16 UIKitCore 0x00000001bf4c146c -[UIViewPropertyAnimator startAnimationAsPaused:] + 1048 (UIViewPropertyAnimator.m:3334)
17 ****** 0x0000000102eb4868 closure #1 in BottomDrawView.showWarningView() + 460 (BottomDrawView.swift:412)
18 ****** 0x0000000102f33378 thunk for @escaping @callee_guaranteed () -> () + 20 (:0)
19 libdispatch.dylib 0x00000001bcca2e6c _dispatch_call_block_and_release + 32 (init.c:1517)
20 libdispatch.dylib 0x00000001bcca4a30 _dispatch_client_callout + 20 (object.m:560)
21 libdispatch.dylib 0x00000001bccb2f48 _dispatch_main_queue_drain + 928 (inline_internal.h:2622)
22 libdispatch.dylib 0x00000001bccb2b98 _dispatch_main_queue_callback_4CF + 44 (queue.c:7770)
23 CoreFoundation 0x00000001bcff5800 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1795)
24 CoreFoundation 0x00000001bcfaf704 __CFRunLoopRun + 2532 (CFRunLoop.c:3144)
25 CoreFoundation 0x00000001bcfc2bc8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
26 GraphicsServices 0x00000001d90f6374 GSEventRunModal + 164 (GSEvent.c:2200)
27 UIKitCore 0x00000001bf932648 -[UIApplication _run] + 1100 (UIApplication.m:3511)
28 UIKitCore 0x00000001bf6b3d90 UIApplicationMain + 364 (UIApplication.m:5064)
29 ****** 0x0000000102864a08 main + 68 (AppDelegate.swift:22)
30 dyld 0x0000000104505ce4 start + 520 (dyldMain.cpp:879)
This was an iOS bug that was fixed with iOS 16.