CoreData ManagedObjectContext Recursive Save Error

前端 未结 1 1702
孤独总比滥情好
孤独总比滥情好 2021-02-07 06:02

Some users of mine are encountering a CoreData error when performing a save. I haven\'t been able to find any information online about this error or how to symbolicate the stack

相关标签:
1条回答
  • 2021-02-07 06:41

    I had the same problem with the Xcode8/ios10. The problem was due to a call to save core data context inside the following method.

    - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
        [self methodCallingSaveContext];
    }
    

    The

    methodCallingSaveContext
    

    calls the save core data context. In order to break the recursive call I rewrote the method in the following way:

    - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
            dispatch_async(dispatch_get_main_queue(), ^{
                   [self methodCallingSaveContext];
             });
    }
    

    Now everything is working again.

    0 讨论(0)
提交回复
热议问题