我尝试使用下面的代码来更新核心数据中的对象,但出现错误。
NSError *error;
NSArray *objects = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
NSLog(@"objects %@",objects);
// yourIdentifyingQualifier is unique. It just grabs the first object in the array.
AllChallenge *tempChallenge = [[managedObjectContext executeFetchRequest:fetchRequest error:&error] objectAtIndex:0];
tempChallenge =[[AllChallenge alloc] init];
NSLog(@"tempchallenge >>>>> %@",tempChallenge);
// update the object
tempChallenge.status = 1;
[self.managedObjectContext save:&error];
编译后我得到CoreData:错误:无法在NSManagedObject类'AllChallenge'上调用指定的初始化程序。谢谢你的帮助。