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:
Printing the description of classClass
prints "DayModel."
I'm not sure this is relevant, but DayModel is implemented in Swift.
asked 51 secs ago
NSManagedObject is failing isKindOfClass test
Aucun commentaire:
Enregistrer un commentaire