有人有什么想法吗?当我尝试合成我在.h文件中声明的属性时,它不让我合成它。有任何想法吗?谢谢!
答案 0 :(得分:54)
当您尝试合成类实现范围之外的属性时,可能会发生这种情况。
不正确:
@synthesize yourProperty;
@implementation YourClass
@end
正确:
@implementation YourClass
@synthesize yourProperty;
@end
答案 1 :(得分:0)
通常在您使用#import
时发生,而不是在文件顶部。