Search code examples
iosobjective-cunrecognized-selector

Objective-C: Diagnosing unrecognized selector error


I am using htautomcomplete to add autocompletion to a textfield and getting the error below.

As far as I know I have made the field in question an HTautomplete field but it is saying that it is trying to send the message to an UITextField. Could this be error or what else could cause this? Thanks for any ideas.

[UITextField setAutocompleteType:]: unrecognized selector sent to instance 0x17eea9a0
(lldb)

//code creating property
@property (unsafe_unretained, nonatomic) IBOutlet HTAutocompleteTextField *titleField;

Solution

  • Since this is an IBOutlet, it's most likely that you didn't set the class of your UITextField in the .xib file to be an HTAutocompleteTextField.

    You can do so by selecting the object in your .xib file, then going to the Identity Inspector and setting the class under Custom Class.