views:

506

answers:

3

i got 3 syntax errors:

"syntax error before "}" token" my code was

IBOutlet UITextView *fruitDescription
}

"syntax error before "{" token" my code was

- (void)viewDidUnload {

"syntax error before "{" token" my code was

- (void)dealloc {

Any ideas?

+2  A: 

There should be a semicolon after

IBOutlet UITextView *fruitDescription

Always try to fix the first error message you see first and recompile. Subsequent errors can go away by fixing the first one.

Mehrdad Afshari
okay when i added the semi colon i got an error saying "syntax error before "AT_NAME" token"
You should really post the complete source.
Mehrdad Afshari
- (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil;}- (void)dealloc { [super dealloc];}@endthats where 2 of the errors areand the 3rd one is a problem with the @end on my view controller . hi can probabally figure out the 3rd one
So where's AT_NAME?
Mehrdad Afshari
@interface FruitViewController : UIViewController { IBOutlet UITextView *fruitDescription;}@property(nonatomic,retain) IBOutlet UITextView *fruitDescription@endit highlighted the "@end" part
You are still missing a semicolon after `@property(nonatomic,retain) IBOutlet UITextView *fruitDescription`. Note that `IBOutlet` is not required on this line.
Mehrdad Afshari
Apple recommends using IBOutlet on the property and connecting tot he property, rather than using IBOutlet on the ivar and connecting to the ivar (and when they are both the same name, its just confusing, but I believe Ithe property will be used in preference to the ivar when they are both the same name, regardless of which has the IBOutlet).
Peter N Lewis
+1  A: 

In the first case, if you were trying to declare a variable, I suspect the problem is that you're missing a semi-colon:

IBOutlet UITextView *fruitDescription;

I don't know what the second and third bits of code are meant to be doing, so it's hard to say how you should change it... please post more of the code, and explain what you want it to be doing.

Jon Skeet
@Jon: `- (void)viewDidUnload` is a method declaration in Obj-C. The `-/+` indicate instance/static methods.
Mehrdad Afshari
I suspected it might be intended as a method declaration, buty it's always helpful to know for sure what the OP is really trying to do :)
Jon Skeet
Yep, of course. I pointed that out since as .NET guys, our world is somewhat different from Obj-C guys. Syntactically, it looks pretty cryptic and unnatural to us.
Mehrdad Afshari
A: 

Missing semicolon after

@property(nonatomic,retain) IBOutlet UITextView *fruitDescription
                                                              ^^^^^
zakovyrya