CoreData属性访问问题

时间:2011-11-16 06:33:32

标签: core-data model

今天我为模型添加了一个属性,但我无法访问该属性: 模型架构:

@implementation NewsContent

@dynamic content;
@dynamic contentId;
@dynamic mediaUrl;
@dynamic peakNum;
@dynamic news;

@end

我刚刚调用了NSLog(@"%@", self.news.content.peakNum);,但是我收到了一个错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NewsContent peakNum]: unrecognized selector sent to instance 0x8359490'
*** First throw call stack:
(0x1e72052 0x3a06d0a 0x1e73ced 0x1dd8f00 0x1dd8ce2 0x283c8 0x1ef91 0x93336a 0xa65a5d8 0x934956 0x1dd851d 0x1dd8437 0x1e0349a 0x2274aff 0x1dd90c9 0x1dd8ce2 0x1dd851d 0x1dd8437 0x2e14ae3 0x2e15115 0x1e4697f 0x1da9b73 0x1da9454 0x1da8db4 0x1da8ccb 0x2004879 0x200493e 0x77ca9b 0x34c0 0x2ce5)
terminate called throwing an exceptionCurrent language:  auto; currently objective-c:

2 个答案:

答案 0 :(得分:0)

您是否还在peakNum声明中添加了@interface作为属性?您是否检查self.news.content是否引用了有效对象?您确定您的错误来自NSLog代码行吗?

答案 1 :(得分:0)

问题已经解决了。 我添加了新的模型版本,但是将属性添加到旧版本中,所以......