我正在使用XIB并尝试将数据插入核心数据,同时我收到通知,并且我在以下方法中执行此操作。
(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(
UIBackgroundFetchResult))completionHandler
{
[arr_message addObject:data];
NSMutableArray *arr_insert_data = [[NSMutableArray alloc]init];
_context=[self managedObjectContext];
[arr_insert_data addObject:local_data];
[mainViewController insertDiscusioninLocalDB:arr_message];
}
-(void)insertDiscusioninLocalDB :(NSMutableArray*)arr_msg
{
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Discusion_data" inManagedObjectContext:app.context];// BREAKS HERE
NSFetchRequest *request = [[NSFetchRequest alloc]init];
NSError *error = nil;
[request setEntity:entity];
}