iOS 应用程序因 cfrunloop_is_calling_out_to_an_observer_callback_function 而崩溃

标签 ios xcode

在运行我的应用程序时,我偶尔会遇到这种崩溃,这似乎与我的代码无关。它是什么以及我如何避免它?

Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x000000018fc4c16c mach_msg_trap + 8 1 libsystem_kernel.dylib
0x000000018fc4bfdc mach_msg + 72 2 AudioToolbox
0x0000000193c8bcdc ASClient_AudioSessionSetActiveWithFlags + 132 3
AudioToolbox 0x0000000193c6c7f4 AudioSessionSetActive_Priv + 360 4 AVFAudio
0x00000001aa46bf8c -[AVAudioSession setActive:withOptions:error:] + 84 5 Jam Session 0x00000001000d41b8 0x1000b0000 + 147896 6 Jam Session 0x00000001000d53fc 0x1000b0000 + 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 0x0000000193fa1e64 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32 18 QuartzCore 0x0000000193f1eb20 CA::Context::commit_transaction(CA::Transaction*) + 252 19 QuartzCore 0x0000000193f45f8c CA::Transaction::commit() + 512 20 QuartzCore
0x0000000193f469ac CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned 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 Session
0x00000001000c36d4 0x1000b0000 + 79572 27 libdyld.dylib
0x000000018fb585b8 start + 4

最佳答案

我今天在对 UIView 进行子类化后遇到了这个问题。为了解决这个问题,我做了以下事情:

  • 为所有异常添加异常断点
  • 启用僵尸对象

在左 Pane 中查看线程堆栈后,我注意到一些与“键路径”和“值”相关的东西。然后我意识到在创建我的子类时,我创建了一个 IBInspectable并在 Storyboard 中更新了这个值。我后来删除了它,这就是导致崩溃的原因,因为该类仍在运行时尝试设置该值。

因此请务必检查您的“用户定义的运行时属性”。

关于iOS 应用程序因 cfrunloop_is_calling_out_to_an_observer_callback_function 而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40056303/

相关文章:

ios - Google NearbyMessages cocoapod 生成 “duplicate output file” 错误

ios - 如何在 UITableView - Swift 中制作 list ?

ios - iOS 项目的 XCode 8 中的 CMake 和代码签名

ios - 无法上传嵌入了内部动态框架的IPA

ios - Swift 子类化 UIViewController 的子类

ios - Swift 2 - 数组是否在设置期间被复制?

ios - 如何在 Swift 3.0 的 Imageview 上显示 .jpg url 图像

xcode - 为 UIButton 设置图像

xcode - 带有标识符X的应用程序ID不可用

ios - Xcode iOS 框架图标含义