Synthesize error “Missing Context for Property Imp

2019-01-26 04:29发布

问题:

Anyone have any ideas? When I try to synthesize a property I have declared in the .h file its not letting me synthesize it. Any ideas? Thanks!

回答1:

This can happen when you attempt to synthesize a property outside of the scope of your class' implementation.

Incorrect:

@synthesize yourProperty;
@implementation YourClass
@end

Correct:

@implementation YourClass
@synthesize yourProperty;
@end


回答2:

It often happen when you use #import ,and does not on the top of file.