App crashing with this error message - I cannot find anything about this after googling it- Can someone help please

[亡魂溺海] 提交于 2019-12-24 17:25:01

问题


Im not getting any compile time errors nor anything comes up when I run Build & Analyze. But at run time my app crashes when I click a uitextfield.

-[__NSCFType textFieldDidBeginEditing:]: unrecognized selector sent to instance 0x583cb90

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType textFieldDidBeginEditing:]: unrecognized selector sent to instance 0x583cb90'


0   CoreFoundation               0x00fa25a9 __exceptionPreprocess + 185

1   libobjc.A.dylib      0x010f6313 objc_exception_throw + 44

2   CoreFoundation   0x00fa40bb -[NSObject(NSObject)doesNotRecognizeSelector:] + 187

3   CoreFoundation       0x00f13966 ___forwarding___ + 966

4   CoreFoundation       0x00f13522 _CF_forwarding_prep_0 + 50

5   UIKit    0x00394581 -[UIControl(Deprecated) sendAction:toTarget:forEvent:] + 67

6   UIKit 0x00396e62 -[UIControl(Internal) _sendActionsForEventMask:withEvent:] + 

7   UIKit   0x0039ce11 -[UITextField willAttachFieldEditor:] + 404

8   UIKit   0x003aecdf -[UIFieldEditor becomeFieldEditorForView:] + 653

9   UIKit   0x0039ef98 -[UITextField _becomeFirstResponder] + 99

回答1:


Chances are that you are either not properly retaining the object you assign as the delegate of your UITextField (e.g. you don't assign it to an outlet property declared retain in IB), or you are calling release or autorelease on an object that you do not own or that you saved into an ivar.

The object eventually gets disposed of, and later a different object happens to be created at the same memory location. But that object, of course, doesn't implement the UITextFieldDelegate protocol, so when the text field tries to send the delegate messages to it it gives you that error instead. Were an object not to be created at that same memory location, you'd get a crash with EXC_BAD_ACCESS instead.




回答2:


In Interface Builder (or possibly in code, but more likely IB) you have the "Editing Did Begin" Sent Event linked to a method that doesn't exist in your code; perhaps it was renamed, or maybe you neglected to delete that link after deleting the action.

When editing begins in your textField the app tries to call the method indicated in IB and fails; "unrecognized selector" is saying that it doesn't recognize a method by that name.

Either just delete the link or delete it and replace it with an appropriate link.



来源:https://stackoverflow.com/questions/5958307/app-crashing-with-this-error-message-i-cannot-find-anything-about-this-after-g

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