Please consider subscribing to Mobile Developer Tips RSS feed or following us on Twitter
|
|
|
I recently ran into this error message within Xcode while writing an iPhone application. I was surprised how long it took to track this down. One of the reasons this is tricky is that message implies that the error occurred in the file referenced in the error message.
For example, in my case, I was looking inside the implementation file (.m) for something obvious to standout.
To get the context of what I am referring to, look at the figure below to see how the message appeared in Xcode on my system:

The crux of the problem was not SomeClass.m, it was one of the .h files imported inside this implementation file that didn’t have a closing @end statement.
Sounds easy enough doesn’t it? Well, most everything is once you’ve found what the problem is. Hopefully this will save you some time if ever encounter this message.
Related posts:
- Properties, Setters and Dot Syntax
- Private Methods
- TextMate and Xcode
Comments
2 Responses to “Error: syntax error before ‘AT_NAME’ token”
Leave Comment
this can also happen when the .h file has a syntax error, such as the last line not having a “;”
[Reply]
This was most helpful. Thank you.
In my case it was a “;” missing:
-(void) dealloc
@end
Best wishes.
[Reply]