Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does the compiler say I haven't declared my variable?
    primarykey
    data
    text
    <p>I am getting an error in Xcode that says "whatEverVariable is undeclared" This is happening inside the .m file and also outside of the class itself. I have declared the variable inside the curly braces of the .h file and am using @property and @synthesize to access the variable. However I am getting that above error in the .m file sometimes and even in other classes where I have #imported the class that contains the variable. Am I missing something about Objective-C in general here or what? I guess what I am asking is why would things be undeclared if they are declared. </p> <p>Also I am getting "button may not respond to "setTitle" as an error as well has this been deprecated or something to "setTitle: forState:" because I am not wanting to use that. </p> <p>I would post an example but I really think I am missing some obvious thing here. Does anyone have any thoughts on what would cause the errors? Sorry to be so general, but I have to be a moron or something? </p> <p>This is saying "picturesInArray is undeclared"</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; @interface Pictures : NSObject { NSMutableArray *picturesInArray; } @property (nonatomic, retain) NSMutableArray *picturesInArray; -(IBAction)pictureButtonPressed:(id)sender; @end #import "Pictures.h" @implementation Pictures @synthesize picturesInArray; -(IBAction)pictureButtonPressed:(id)sender { if (pictureIndex &gt;= [picturesInArray count] || pictureIndex &lt; 0) { pictureIndex = 0; [imageView setImage:[picturesInArray objectAtIndex:pictureIndex]]; [imageView setNeedsDisplay]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload