开发者

What can be causing this crash?

开发者 https://www.devze.com 2023-01-26 08:39 出处:网络
I\'ve recently had a crash concerning a selector not being found when a notification was posted using NSNotificationCenter. What can be causing this error?

I've recently had a crash concerning a selector not being found when a notification was posted using NSNotificationCenter. What can be causing this error?

I've noticed that there was no user code being called after the notification was posted, so that doesn't seem to be a problem on the receiving side of the notifi开发者_如何转开发cation. However, what could cause NSNotificationCenter to crash?

Here's the stack trace of the call:

0   libSystem.B.dylib               0x00078ac8 __kill + 8
1   libSystem.B.dylib               0x00078ab8 kill + 4
2   libSystem.B.dylib               0x00078aaa raise + 10
3   libSystem.B.dylib               0x0008d03a abort + 50
4   libstdc++.6.dylib               0x00044a20 __gnu_cxx::__verbose_terminate_handler() + 376
5   libobjc.A.dylib                 0x00005958 _objc_terminate + 104
6   libstdc++.6.dylib               0x00042df2 __cxxabiv1::__terminate(void (*)()) + 46
7   libstdc++.6.dylib               0x00042e46 std::terminate() + 10
8   libstdc++.6.dylib               0x00042f16 __cxa_throw + 78
9   libobjc.A.dylib                 0x00004838 objc_exception_throw + 64
10  CoreFoundation                  0x000a167c -[NSObject(NSObject) doesNotRecognizeSelector:] + 96
11  CoreFoundation                  0x000491d2 ___forwarding___ + 502
12  CoreFoundation                  0x00048f88 _CF_forwarding_prep_0 + 40
13  Foundation                      0x000146ac _nsnote_callback + 136
14  CoreFoundation                  0x0002670c __CFXNotificationPost_old + 396
15  CoreFoundation                  0x000263ac _CFXNotificationPostNotification + 112
16  Foundation                      0x0000b014 -[NSNotificationCenter postNotification:] + 132
17  [My Application]                0x000a5ad2 -[PortfolioUpdateOperation main] (PortfolioUpdateOperation.m:37)
18  Foundation                      0x0000e9e8 -[__NSOperationInternal start] + 652
19  Foundation                      0x0000e74c -[NSOperation start] + 16
20  Foundation                      0x00023574 ____startOperations_block_invoke_2 + 40
21  libSystem.B.dylib               0x000d597c _dispatch_call_block_and_release + 12
22  libSystem.B.dylib               0x000d675c _dispatch_worker_thread2 + 120
23  libSystem.B.dylib               0x0007a67a _pthread_wqthread + 258
24  libSystem.B.dylib               0x00073190 start_wqthread + 0


Most likely NSNotificationCenter is trying to notify an object instance that no longer exists.

In other words, an object was deallocated without removing itself as a NSNotificationCenter observer. Check your code for cases when an object adds itself as a NSNotificationCenter observer but fails to remove itself from NSNotificationCenter.


Looks like you added an object as an observer that doesn't respond to the selector you provided. Make sure your notification method accepts one argument of type NSNotification


Maybe a check to respondsToSelector followed with some logging of the object's class name etc could help you further?

0

精彩评论

暂无评论...
验证码 换一张
取 消