-[NSManagedObject objectID]: unrecognized selector sent to class
-[NSManagedObject objectID]: unrecognized selector sent to class
- Subject: -[NSManagedObject objectID]: unrecognized selector sent to class
- From: Matt Bigarani <email@hidden>
- Date: Thu, 4 Mar 2010 11:32:57 -0800
Hey all,
I'm experiencing some weirdness with NSManagedObject. Basic
background, I have an NSManagedObject 'surveyGroup', which has a
to-many relationship to another NSManagedObject, surveyResults.
I'm attempting to access the surveyResults object in two different
methods. It works fine in the first method, but in the second method I
get the error:
"-[NSManagedObject objectID]: unrecognized selector sent to class"
When trying to access any of the properties of the surveyResult
object. If I comment out the first method, the second method is able
to access the properties of the surveyResult object without error.
Am I doing anything obviously wrong here that would leave surveyResult
un-usable the next time I try to access it?
NSUInteger index = 0;
NSMutableSet *surveyResultSet = [group mutableSetValueForKey:@"survey_results"];
NSMutableArray * surveyResultArray = [[NSMutableArray alloc] init];
[surveyResultArray addObjectsFromArray:[surveyResultSet allObjects]];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]
initWithKey:@"date" ascending:YES];
[surveyResultArray sortUsingDescriptors:[NSArray
arrayWithObject:sortDescriptor]];
[sortDescriptor release];
NSManagedObject * surveyResult = [surveyResultArray objectAtIndex:index];
NSManagedObject * survey = [surveyResult valueForKey:@"survey"];
NSString * surveyName = [survey valueForKey:@"name"];
NSString * title = [NSString stringWithFormat:@"%@", surveyName];
[surveyResultArray release];
return title;
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden