Core Data error 133020: problems merging in a save:

后端 未结 2 1666
悲哀的现实
悲哀的现实 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.

提交回复
热议问题