I’m trying to convert an Xcode 3(iOS 4.3) project to ARC in Xcode 4.2 (iOs 5), but when I try to pre-check the project, I get a bunch of different errors that I need to fix before moving on. One of those errors is the following message:
*”receiver type ‘Assignment‘ for instance message does not declare a method with selector ‘gradable‘*,
where Assignment is the core data managed object and gradable is the property…
Here is the line where I’m getting the error:
if ([[[[assignment gradable]description]description] isEqualToString:@"true"]) {
And here is for better understanding:
for(int i = 0; i < [assignmentArrays count]; i++) {
for (Assignment* assignment in [assignmentArrays objectAtIndex:i]) {
if ([[[[assignment gradable]description]description] isEqualToString:@"true"]) {
[[gradableAssignmentsArray objectAtIndex:i] addObject:assignment];
}
}
}
[assignmentArrays release];
So, if I understand it correctly, I need to declare the method so I can use it here… but being a core data object, I’m a little confused on this one… I did some research but couldn’t find anything core data related.. 😐
Thanks in advance!!! 🙂
Do
[assignment valueForKey:@"gradable"]if it’s a NSManagedObject that you haven’t subclass that should make the compiler quieter, but if that object don’t have a key @”gradable”, you will have a run time exception and will crash. (you can also use that on a subclass)If you have subclassed the NSManagedObject and want to use something else that valueForKey (because string are more error prone), declare the property in that subclass so the compiler can find it. In the
.myou wouldn’t use@synthesisin this case but the@dynamickeyword, which is basically telling the compiler, I don’t have an implementation for this property, but at run time you will have one. And that one will be provided by Core Data.