Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 尝试在实体中添加心房肌时发出SIGABRT。iOs上的核心数据_Iphone_Objective C_Core Data_Sigabrt_Nsentitydescription - Fatal编程技术网

Iphone 尝试在实体中添加心房肌时发出SIGABRT。iOs上的核心数据

Iphone 尝试在实体中添加心房肌时发出SIGABRT。iOs上的核心数据,iphone,objective-c,core-data,sigabrt,nsentitydescription,Iphone,Objective C,Core Data,Sigabrt,Nsentitydescription,当我尝试向我的实体添加属性时,我的应用程序会收到SIGABRT NSManagedObjectContext *context=[[HistoryDataManager sharedInstance] mainObjectContext]; NSEntityDescription * entityDescription = [NSEntityDescription entityForName:@"Request" inManagedObjectContext:context];

当我尝试向我的实体添加属性时,我的应用程序会收到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]);  
    }
我有一个名称请求和上下文的实体=没有,但每次在这里我都会收到SIGABRT的信息:

NSEntityDescription * entityDescription = [NSEntityDescription entityForName:@"Request" inManagedObjectContext:context];

最有可能的
context
是nil。传递nil托管对象上下文值通常会导致崩溃。在将值传递给方法之前,请确认在
上下文中有值


同时检查实体名称

问题出在我的DataManager singleton中,很抱歉浪费了您的时间。

我们可以得到完整的SIGABRT消息吗?控制台中没有SIGABRT消息我在上下文中有价值,我肯定有实体和名称请求