How do I debug this error: CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER?

自古美人都是妖i 提交于 2020-01-22 09:32:09

问题


I am getting an error in my app that I have no idea of how to figure out, has anyone seen this before:

#   Binary Image Name   Address Symbol
0   RepZio  0x002bd302  testflight_backtrace
1   RepZio  0x002bc996  TFSignalHandler
2   libsystem_platform.dylib    0x39ce0062  _sigtramp
3   CoreFoundation  0x2edde118  __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
4   CoreFoundation  0x2ed52256  _CFXNotificationPost
5   Foundation  0x2f737c2c  -[NSNotificationCenter postNotificationName:object:userInfo:]
6   Foundation  0x2f73c50a  -[NSNotificationCenter postNotificationName:object:]
7   UIKit   0x3180b2cc  -[UIApplication _performMemoryWarning]
8   libdispatch.dylib   0x39ba0d06  _dispatch_client_callout
9   libdispatch.dylib   0x39ba9802  _dispatch_source_invoke$VARIANT$mp
10  libdispatch.dylib   0x39ba773c  _dispatch_main_queue_callback_4CF$VARIANT$mp
11  CoreFoundation  0x2ede6818  __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
12  CoreFoundation  0x2ede50ec  __CFRunLoopRun
13  CoreFoundation  0x2ed4fc26  CFRunLoopRunSpecific
14  CoreFoundation  0x2ed4fa0a  CFRunLoopRunInMode
15  GraphicsServices    0x33a50282  GSEventRunModal
16  UIKit   0x315f3048  UIApplicationMain
17  MyAppName   0x00109afa  main in main.m on Line 15
18  libdyld.dylib   0x39bc5ab6  start

Lost on this one.


回答1:


Make sure you remove all notification observers before freeing them. This problem occurs when an observer is freed and notification center has still a pointer to that object and tries to notify it. Check that all addObserver have the corresponding removeObserver calls.




回答2:


I know it's old question, but maybe I will help to someone.

In my case the same crash occurred when NSTextField in NSTableViewCell was in editing mode and user tried to select value from combobox outside of tableView without finishing editing. And the same CFNOTIFICATIONCENTER_... crash was on line [tableView reloadData].

So, my way to resolve crash was to put [self.window makeFirstResponder:nil] before reloading the table.



来源:https://stackoverflow.com/questions/20746435/how-do-i-debug-this-error-cfnotificationcenter-is-calling-out-to-an-observer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!