Core Data error 133020: problems merging in a save:

后端 未结 2 1617
悲哀的现实
悲哀的现实 2021-02-20 05:50

First off I want to say that I am not using threads or multiple contexts and I have read and worked from every related answer I could find on SO. I have a project which I have a

相关标签:
2条回答
  • 2021-02-20 06:09

    Have you tried setting the merge policy on your managed object context?

    The default is NSErrorMergePolicy which will just throw errors. Your other options are here.

    I'd suggest this one :

    [self.managedObjectContext setMergePolicy:NSMergeByPropertyObjectTrumpMergePolicy];
    

    Just noticed something that might be causing problems in your swapping tracks code.

    Instead of

    OT_Track *track;
    
    track = [[self.tracksArray objectAtIndex: fromIndexPath.row] retain];
    [self.tracksArray removeObjectAtIndex: fromIndexPath.row];
    [self.tracksArray insertObject:track atIndex: toIndexPath.row];
    [track release];
    

    try the code snippet from this blog post.

    I think that your track swapping code might be getting indexes confused halfway through the swap.

    0 讨论(0)
  • 2021-02-20 06:15

    I'm still not really sure what caused this but the issue reoccurred and I solved it by ensuring that any methods that referenced core data were executed on the main thread using performSelectorOnMainThread.

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