Automatic @property synthesize not working on NSManagedObject subclass

大城市里の小女人 提交于 2019-11-29 20:59:05

I faced the same problem and found the reason and the solution.

If you look at the header file of NSManagedObject in iOS 6 SDK, you'll see "NS_REQUIRES_PROPERTY_DEFINITIONS" which forces classes to specify @dynamic or @synthesize for properties.

(You can see the NS_REQUIRES_PROPERTY_DEFINITIONS in the API diff between iOS 5.1 and iOS 6.0.)

This is because the compiler has to know if you want a property to be dynamic or synthesized especially in the implementation of a subclass of NSManagedObject class.

I could solve this problem simply by adding the @synthesize lines explicitly for the properties other than @dynamic in NSManagedObject subclasses.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!