I'm trying to instantiate an NSManagedObject, but the thread seems to hang when doing so. Here's the code:
NSLog(@"here");
WinkProfileData *profileData = [[WinkProfileData alloc] initWithEntity: entity insertIntoManagedObjectContext: delegate.managedObjectContext];
NSLog(@"but not here");
WinkProfileData
was generated using the Xcode generator. What could be wrong?
It's seems that I omitted an important part, which is where the mistake was:
WinkAppDelegate *delegate = [UIApplication sharedApplication].delegate;
NSEntityDescription *entity = [NSEntityDescription entityForName:WinkProfileDataEntityIdentifier inManagedObjectContext:delegate.managedObjectContext];
WinkProfileData *profileData = [[WinkProfileData alloc] initWithEntity: entity insertIntoManagedObjectContext: delegate.managedObjectContext];
It didn't seem relevant because it hang in the last line, but I guess it's always relevant =)
Anyway, it wouldn't be easy to find it. It so happens that the constant WinkProfileDataEntityIdentifier
had the wrong value. It's just odd that the thread "just" hangs... Maybe there should be an error of some kind.