error in synthesizing variable and implementing method
I'm getting error when synthesizing variable '@synthes开发者_运维技巧ize property must be in implementation context' and for method 'Method definition not in @implementation context' how should i resolve it? Thank you
Put all your class method and @synthesize
variable between
@implementation
and @end
in your .m (implementation) file .
@implementation MyClass
@synthesize myVar1,myVar2,myVar3;
-(void) method1:(id) myVariable
{
}
-(void) method2
{
}
@end
From error description I guess you've put @synthesize directive outside of class implementation, i.e. make sure that it goes after @implementation in you file:
@implementation MyClass
@synthesize myVar;
精彩评论