Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Use of undeclared identifier"

I'm pretty new to Objective C. Keep getting this error

"Use of undeclared identifier"

for this line of code:

NSString *textOut1 = textOut.text;

Obviously I am just trying to pull the textbox text. I have declared the following in my h file

@property (weak, nonatomic) IBOutlet UITextField *textOut;

So I cannot understand why I keep getting that damn error. Thanks!

like image 622
Alec. Avatar asked Dec 12 '25 23:12

Alec.


1 Answers

Use this:

NSString *textOut1 = _textOut.text;

Checkout the extra underscore I added in front of textOut

Read the paragraph titled Most Properties Are Backed by Instance Variables in this apple documentation page.

like image 84
Sarwar Erfan Avatar answered Dec 15 '25 12:12

Sarwar Erfan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!