开发者

iPhone app: "Parse issue - expected ';' after @synthesize"

I'm working on an iPhone app and got this strange things happening.

I have a property declared in my .h file:

BOOL shouldProcessVenueListRequest;
@property(nonatomic, assign) BOOL shouldProcessVenueListRequest;

So far, so good. Then in my implementation .m file:

@synthesize shouldProcessVenueListRequest;

This works perfectly well for about 20 other properties, but for this one, I'm getting an error in the implementation: "Parse Issue - 开发者_如何学编程Expected ';' after @synthesize" - and the error pointer is in the middle of the variable name - see the image.

iPhone app: "Parse issue - expected ';' after @synthesize"

I tried removing and re-adding this property manually; tried copy/paste variable name from .h - nothing worked. I'm totally confused about this now. Any help is greatly appreciated.


Thanks to all who replied. It turned out to be an issue with the XCode rather than anything wrong with my code. Apparently, when I was typing the code in, I was interrupted half-way into typing, so that error message was valid (at the time). Then, about an hour later I came back to it and completed typing - but for some reason XCode was stuck on this error message.

I did 'clean', then 'build' - didn't help. So I did 'clean' again and then closed project. When I reopened the project and did 'build' again - the error wasn't there any more.


Strange problem. Try the following:

  • Try another name for your property (maybe it is a keyword/name used elsewhere, namely in any of Apple's framwork or similar - you could try command-clic on the word to see if Xcode finds its definition anywhere else than in your header file maybe?)

  • Be sure there is no hidden (non-printable) character

  • Try another place for your @synthesize, moving it one or two lines below, to check if the error comes from this very property or the one above it


[EDIT] Did't see this in your screenshot the first time, but it seems you have a semicolon right in the middle of your @synthesize shouldProcessVenueListRequ;est;, between the 'qu' and the 'est'... or is it the Fix-it proposition?


Check your code to ensure a few things

  1. There is no space between shouldProcessVenueListRequ and est (even I thought you had a ; in there between the two parts :)

  2. If you are copy-pasting the variable name from some place, you might want to type it all out manually (as Ali suggests, there might be a hidden character)

  3. Try doing a clean-build


Even I got the same problem. When I checked it out, I gave the same name for variables but in different files. I just gave different names for all the variables, like if I have used a variable coupon in more than one file, I made it one as couponDisplay in one and couponList as another.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜