2011-11-16 147 views
0

今天,我已經加入了該模型的屬性,但我不能訪問屬性: 模型架構:CoreData屬性訪問問題

@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: 

回答

0

你還可以添加peakNum作爲@interface聲明的屬性?您是否檢查self.news.content是否引用了有效的對象?你確定你的錯誤來自NSLog代碼行嗎?

+0

謝謝你們都一樣。 –

0

問題已解決。 我已添加新的型號版本,但將屬性添加到舊版本,所以.....