jeudi 1 janvier 2015

NSManagedObject is failing isKindOfClass test


Vote count:

0




I have an NSManagedObject. When I create an instance, it fails the isKindOfClass method unexpectedly.



NSEntityDescription *entity = [NSEntityDescription entityForName:@"DayModel" inManagedObjectContext:context];
DayModel *day = [[DayModel alloc] initWithEntity:entity insertIntoManagedObjectContext:context];

if ([day isKindOfClass:[DayModel class]]) {
NSLog(@"True");
} else {
NSLog(@"False");
}


Output:



False


I added the following code:



Class objectClass = [day class];
Class classClass = [DayModel class];


And looking at it in the debugger this is what I found:


enter image description here


Printing the description of classClass prints "DayModel."


I'm not sure this is relevant, but DayModel is implemented in Swift.



asked 51 secs ago

rob

1,536






NSManagedObject is failing isKindOfClass test

Aucun commentaire:

Enregistrer un commentaire