我试图实例化一个NSManagedObject,但这样做时线程似乎挂了。这是代码:
NSLog(@"here");
WinkProfileData *profileData = [[WinkProfileData alloc] initWithEntity: entity insertIntoManagedObjectContext: delegate.managedObjectContext];
NSLog(@"but not here");
WinkProfileData
是使用Xcode生成器生成的。可能有什么不对?
答案 0 :(得分:0)
似乎我省略了一个重要部分,这就是错误所在:
WinkAppDelegate *delegate = [UIApplication sharedApplication].delegate;
NSEntityDescription *entity = [NSEntityDescription entityForName:WinkProfileDataEntityIdentifier inManagedObjectContext:delegate.managedObjectContext];
WinkProfileData *profileData = [[WinkProfileData alloc] initWithEntity: entity insertIntoManagedObjectContext: delegate.managedObjectContext];
它似乎没有相关性,因为它挂在最后一行,但我想这总是相关的=)
无论如何,找到它并不容易。碰巧的是,常量WinkProfileDataEntityIdentifier
的值不正确。线程"只是"挂起...也许应该有某种错误。