2

I have an core data NSSet of objects through a relationship that I am trying to put into an array.

When I call the 'allObjects' selector I get a crash on my object in the NSSet that the selector does not exist. Well, it obviously doesn't, but how do I get my data to copy into the array?

Heres the code that crashes.

NSArray *items = [surveyCategory.surveyQuestions allObjects];

Inside my surveyQuestions NSSet are SurveyQuestion objects. And this throws the error `[SurveyQuestion allObjects]: unrecognized selector sent to instance

Any ideas on how to fix this?

thanks

4

1 回答 1

4

从错误消息看来,它似乎surveyQuestions不是您期望的一对多关系,而是一对一关系,因此这surveyCategory.surveyQuestions 是一个SurveyQuestion对象而不是集合。

也许你改变了 Core Data 模型并且没有重新创建托管对象子类文件,这样编译器就没有抱怨了。

于 2013-08-20T19:03:26.793 回答