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.
UPDATE
This is failing in my test class, but not in the iOS app. The problem seems similar to this issue. However, I've added all the classes I can to the test target and it is still failing.