cannot assign to 'self' outside of a method in the init family

在写程序时遇到这个错误,“cannot assign to 'self' outside of a method in the init family”,在网上查询后,得到了一个很奇怪的正确答案。

我一开始写的initwithCityCode,出现这个错误,在别人的回答中,竟然是把with中的小写‘w’改成大写的‘W’。改过之后一切都好了。太神奇了。

posted @ 2013-07-24 19:30  javawebsoa  Views(2023)  Comments(0Edit  收藏  举报