PiotrDomo
PiotrDomo

Reputation: 1045

- [NSTextField dataUsingEncoding:allowLossyConversion:] unrecognised selector sent to instance

In my application I initiate object with initWithNibName:bundle: file. I found that the object is corrupt. When I put the breakpoint in -awakeFromNib or even in init method and call in console to display self (po self) I get following message:

- [NSTextField dataUsingEncoding:allowLossyConversion:] unrecognised selector sent to instance

Interesting is that exception breakpoint is not getting called. As it is method of NSString it should get called. I also don't call the method dataUsingEncoding:allowLossyConversion: manually anywhere. All the NSTextField objects in nib file are connected to files owner properties.

Any hints on fixing this problem?

Upvotes: 1

Views: 437

Answers (1)

PiotrDomo
PiotrDomo

Reputation: 1045

After some time, finally, I've figured out the issue. My answer can be a hint to anyone who is facing the same problem.

NSTextField in header files was declared as follows:

@property (nonatomic, weak) IBOutlet NSTextField *description;

Word "description" is reserved word by NSObject, thus it should be avoided as property in general.

This solved my problem:

@property (nonatomic, weak) IBOutlet NSTextField *desc;

Upvotes: 3

Related Questions