- [_ NSObserverList setCursorPosition:]

最光阴*_*最光阴 16 exception objective-c uikeyboard ios unrecognized-selector

我收到#560 NSInvalidArgumentException错误,如下所示;

-[_NSObserverList setCursorPosition:]: unrecognized selector sent to instance 0x1702a6ea0

CoreFoundation ___exceptionPreprocess

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x1854f21c0 __exceptionPreprocess
1  libobjc.A.dylib                0x183f2c55c objc_exception_throw
2  CoreFoundation                 0x1854f9278 __methodDescriptionForSelector
3  CoreFoundation                 0x1854f6278 ___forwarding___
4  CoreFoundation                 0x1853f059c _CF_forwarding_prep_0
5  UIKit                          0x18b830418 -[_UIKeyboardTextSelectionController selectTextWithGranularity:atPoint:executionContext:]
6  UIKit                          0x18b8304b0 -[_UIKeyboardTextSelectionController selectTextWithGranularity:atPoint:completionHandler:]
7  UIKit                          0x18b895928 -[_UIKeyboardBasedNonEditableTextSelectionGestureController oneFingerForcePan:]
8  UIKit                          0x18b91b59c -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:]
9  UIKit                          0x18b91eca4 _UIGestureRecognizerSendTargetActions
10 UIKit                          0x18b4e02e8 _UIGestureRecognizerSendActions
11 UIKit                          0x18b37e828 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:]
12 UIKit                          0x18b90ece8 _UIGestureEnvironmentUpdate
13 CoreFoundation                 0x18549f7dc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
14 CoreFoundation                 0x18549d40c __CFRunLoopDoObservers
15 CoreFoundation                 0x18549d89c __CFRunLoopRun
16 CoreFoundation                 0x1853cc048 CFRunLoopRunSpecific
17 GraphicsServices               0x186e52198 GSEventRunModal
18 UIKit                          0x18b3b82fc -[UIApplication _run]
19 UIKit                          0x18b3b3034 UIApplicationMain
20 MyAppName                      0x100050054 main (main.m:16)
21 libdispatch.dylib              0x1843b05b8 (Missing)
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议我可能是什么问题?

Mih*_*mar 1

这种 NSInvalidArgumentException,特别是因为它位于私有类上,可能是由于 Zombie 对象造成的。您正在向不再存在的对象发送消息“setCursorPosition:”,但另一个对象位于该对象的位置。在本例中为“_NSObserverList”。

尝试使用“僵尸对象”诊断对象运行来追踪哪个对象应该接收该消息但已经消失了。该选项在对象被释放时将其保留在内存中,但标记为僵尸。