问题描述
在运行我的应用程序时,我偶尔会遇到这个似乎与我的代码无关的崩溃.它是什么以及我如何避免它?
When running my app I occasionally get this crash that seems not to have anything with my code. What is it and how my I avert it?
线程 0 名称:调度队列:com.apple.main-thread 线程 0崩溃:0 libsystem_kernel.dylib 0x000000018fc4c16cmach_msg_trap + 8 1 libsystem_kernel.dylib
0x000000018fc4bfdc mach_msg + 72 2 AudioToolbox
0x0000000193c8bcdc ASClient_AudioSessionSetActiveWithFlags + 132 3
音频工具箱 0x0000000193c6c7f4AudioSessionSetActive_Priv + 360 4 AVFAudio
0x00000001aa46bf8c -[AVAudioSession setActive:withOptions:error:] +84 5 Jam 会话 0x00000001000d41b8 0x1000b0000 +147896 6 Jam 会话 0x00000001000d53fc0x1000b0000 + 152572 7 UIKit
0x0000000196ae90ec -[UIViewController loadViewIfRequired] + 1056 8
UIKit 0x0000000196ba2cdc-[UINavigationController _layoutViewController:] + 72 9 UIKit 0x0000000196ba2bb4 -[UINavigationController_updateScrollViewFromViewController:toViewController:] + 416 10 UIKit 0x0000000196ba1efc -[UINavigationController_startTransition:fromViewController:toViewController:] + 140 11 UIKit 0x0000000196ba1948 -[UINavigationController_startDeferredTransitionIfNeeded:] + 856 12 UIKit 0x0000000196ba14fc -[UINavigationController viewWillLayoutSubviews]+ 64 13 UIKit 0x0000000196ba1460 -[UILayoutContainerView layoutSubviews] + 188 14 UIKit 0x0000000196ae625c -[UIView(CALayerDelegate) layoutSublayersOfLayer:]+ 1196 15 QuartzCore 0x0000000193fad2c8 -[CALayer layoutSublayers] + 148 16 QuartzCore
0x0000000193fa1fa4 CA::Layer::layout_if_needed(CA::Transaction*) +292 17 QuartzCore 0x0000000193fa1e64CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32 18QuartzCore 0x0000000193f1eb20CA::Context::commit_transaction(CA::Transaction*) + 252 19 QuartzCore0x0000000193f45f8c CA::Transaction::commit() + 512 20 QuartzCore
0x0000000193f469acCA::Transaction::observer_callback(__CFRunLoopObserver*, 无符号long, void*) + 120 21 CoreFoundation
0x0000000190c4a7dc__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 32 22 CoreFoundation 0x0000000190c4840c__CFRunLoopDoObservers + 372 23 CoreFoundation 0x0000000190b77068 CFRunLoopRunSpecific + 476 24 UIKit
0x0000000196b542ec -[UIApplication _run] + 608 25 UIKit
0x0000000196b4f070 UIApplicationMain + 208 26 Jam 会话
0x00000001000c36d4 0x1000b0000 + 79572 27 libdyld.dylib
0x000000018fb585b8 开始 + 4
推荐答案
我今天在对 UIView
进行子类化后遇到了这个问题.为了解决这个问题,我做了以下事情:
I came across this issue today after subclassing a UIView
. To resolve this I did the following:
- 为所有异常添加异常断点
- 启用僵尸对象
在左窗格中查看线程堆栈后,我注意到与关键路径"和值"相关的一些内容..然后我意识到在创建我的子类时,我创建了一个 IBInspectable
并在故事板中更新了这个值.后来我删除了它,这就是导致崩溃的原因,因为该类仍在尝试在运行时设置此值.
After viewing the thread stack on the left pane, I noticed something related to "key path" and "value".. then I realised that when creating my subclass, I'd created an IBInspectable
and updated this value in the storyboard. I later removed this and this is what caused the crash, because the class was still trying to set this value at runtime.
因此请务必检查您的用户定义的运行时属性".
So make sure to check your "User Defined Runtime Attributes".
这篇关于iOS 应用程序因 cfrunloop_is_calling_out_to_an_observer_callback_function 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!