neuromancer
neuromancer

Reputation: 55579

"UITextField isNaturallyRTL"

My iphone app crashes with the following error message:

2010-07-26 16:27:30.402 Nav[814:207] * -[UITextField isNaturallyRTL]: unrecognized selector sent to instance 0x3947fe0 2010-07-26 16:27:30.403 Nav[814:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UITextField isNaturallyRTL]: unrecognized selector sent to instance 0x3947fe0'

I can't find the text isNaturally RTL in my program. Any ideas on how to find the bug?

Upvotes: 2

Views: 1885

Answers (3)

neuromancer
neuromancer

Reputation: 55579

I found the problem. It was in this line of code:

[tempValues setObject:textFieldBeingEdited forKey:tagAsNum];

I changed it to the following:

[tempValues setObject:textFieldBeingEdited.text forKey:tagAsNum];

and that's what fixed it.

Upvotes: 3

mvds
mvds

Reputation: 47114

It seems that isNaturallyRTL is an (undocumented) NSString method. At least NSString responds to it.

This may mean that you assign a UITextField to some variable, where you should put in an NSString instead.

BTW: 0x3947fe0 is the pointer to the UITextField that should be an NSString, so if you're totally lost, try to find out which UITextField has that address (e.g. by a dumb NSLog("tf X: 0x%x",tfx);)

Upvotes: 7

Yuji
Yuji

Reputation: 34195

It's because your UITextField object is somehow assigned to a variable/property which is not supposed to be a UITextField.

It can happen in many different ways.

  1. You might have connected the IB outlet incorrectly. Check your nib in the Interface Builder to see your UITextField is not connected to something strange.
  2. You might have just assigned an UITextField to a variable of a different type. In that case, the compiler should have given you a warning. Correct your code and remove all the warnings.
  3. You might have not correctly done retain/release. Do "build and analyze", and remove all warnings.

Upvotes: 2

Related Questions