合成错误“属性实现声明的缺少上下文”。 [英] Synthesize error "Missing Context for Property Implementation Declaration"

查看:70
本文介绍了合成错误“属性实现声明的缺少上下文”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人有什么想法吗?当我尝试合成属性时,我已经在.h文件中声明了它不允许我对其进行合成。有任何想法吗?谢谢!

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!

推荐答案

当您尝试合成超出类实现范围的属性时,可能会发生这种情况。

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

错误:

@synthesize yourProperty;
@implementation YourClass
@end

正确:

@implementation YourClass
@synthesize yourProperty;
@end

这篇关于合成错误“属性实现声明的缺少上下文”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆