개체를 저장할 때 MagicalRecord를 사용하는 데 문제가 발생했습니다.Exec가 개체를 저장할 때 MagicalRecord를 사용하여 액세스 할 수 없음
사용하여 상황에 맞는 절약 :
//get correct order based on indexPath
Order *orderToComplete = [self objectInOrdersAtIndex:indexPath.section];
//set order as completed
[MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext)
{
Order *localOrder = [orderToComplete inContext:localContext];
[localOrder setIsCompletedValue:YES];
}completion:^(BOOL success, NSError *error)
{
if(success)
NSLog(@"You successfully saved your context.");
else
NSLog(@"Error saving context: %@", error.description);
}];
을하지만 여전히 무작위로 충돌이 원인이 내가 사용했던 [[self MR_defaultContext] mergeChangesFromContextDidSaveNotification:notification];
다른 방법에 내 응용 프로그램 EXEC_BAD_ACCESS와 무작위로 충돌을 일으킬
- (void)saveContext {
[[NSManagedObjectContext defaultContext] saveToPersistentStoreWithCompletion:^(BOOL success, NSError *error) {
if (success) {
NSLog(@"You successfully saved your context.");
} else if (error) {
NSLog(@"Error saving context: %@", error.description);
}
}];
}
을 .
내 응용 프로그램이 다중 스레드 응용 프로그램이 아닙니다. 여기에 있습니다 :
누구 아이디어가 있습니까?
같은 문제가 있습니다. 해결 했니? –