iPhone开发常见错误:synthesized property ‘xxx’ must either be named the same…

这也是个iPhone开发初学者常犯的错误。原因是声明属性的时候,没有一个配套的私有属性。

@property (nonatomic,retain) IBOutlet XXX *xxx;

在类里如果不给他指定对应的私有属性,即使给属性赋值了,也无法保存,就会产生这个错误。

synthesized property ‘xxx’ must either be named the same as a compatible ivar or must explicitly name an ivar

不过这个错误在加入@synthesize xxx;以后才会出现。因为@synthesize会帮你生成一个getter和setter方法。

Posted in 未分类 at 09月 15th, 2009. Trackback URI: trackback

One Response to “iPhone开发常见错误:synthesized property ‘xxx’ must either be named the same…”

  1. 09月 27th, 2009 at 02:51 #Pavlosius

    Блог очень качественный. Вручить бы Вам награду за него или просто почетный орден. :)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
请输入图片中的字符以验证你并非垃圾机器人. 点击图片收听验证码的语音版.
点击这里收听此验证码的语音版本