当我尝试将属性添加到我的实体时,我的应用程序会收到 SIGABRT。
NSManagedObjectContext *context=[[HistoryDataManager sharedInstance] mainObjectContext];
NSEntityDescription * entityDescription = [NSEntityDescription entityForName:@"Request" inManagedObjectContext:context];
Request *request=[[[Request alloc] initWithEntity:entityDescription insertIntoManagedObjectContext:context] autorelease];
NSLog(@"request: %@", request);
request.requestText=string;
request.timeStamp=[NSDate date];
[context insertObject:request];
NSError * error;
if (![context save:&error]) {
NSLog(@"Saving error : %@", [error userInfo]);
}
我有一个名称为 Request 和 context!=nil 的实体,但我每次都在这个地方收到 SIGABRT 消息:
NSEntityDescription * entityDescription = [NSEntityDescription entityForName:@"Request" inManagedObjectContext:context];