初学者经常会碰到使用@synthesize编译属性的时候报:missing context for property的错误,这是因为@synthesize写在了@implemention外面了,也就是写在#import里,正确的应该写在@implemention里面。如下:
Incorrect:
@synthesize yourProperty;
@implementation YourClass
@end
Correct:
@implementation YourClass
@synthesize yourProperty;
@end
本文介绍了一个常见的Objective-C编程错误——使用@synthesize属性时出现的“missing context for property”错误,并提供了正确的@synthesize声明位置来避免该错误。
1026

被折叠的 条评论
为什么被折叠?



