Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:13:42+00:00 2026-06-01T09:13:42+00:00

First off I want to say that I am not using threads or multiple

  • 0

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 added Core Data to and am finding it impossible to find a pernicious bug. I can reproduce the bug every time using the following code.

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath   {

    OT_Track *track;

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

    for( int n = 0; n < [self.tracksArray count]; n++ ) {
        track = [self.tracksArray objectAtIndex:n];
        track.positionInPlaylist = [NSNumber numberWithInteger:n];
    }

    if( [self.managedObjectContext hasChanges] && ![self.managedObjectContext save:&error] )    {
        NSLog(@"Unable to Save Core Data Context");
    }
}

self.tracksArray is an NSMutableArray populated from a fetch performed in viewWillAppear. OT_Track is an Entity defined in my momd which has a field called positionInPlaylist (defined as Integer32). positionInPlaylist stores the position of an OT_Track in an OT_Playlist which allows the user to re-order items in the playlist.

I would be so grateful for any assistance on this as it’s driving me nuts!

the error I am getting is..

**************  Error  ********    The operation couldn’t be completed. (Cocoa error 133020.)
2012-03-27 13:03:32.578 OneTrack[7693:707]   detailedErrors: (null)
2012-03-27 13:03:32.587 OneTrack[7693:707]   {
    conflictList =     (
        "NSMergeConflict (0x4018590) for NSManagedObject (0x40d7e60) with objectID '0x40debd0 <x-coredata://3A300D46-4B20-46DA-A82E-0785BFFAFF14/OT_Track/p2642>' with oldVersion = 1 and newVersion = 2 and old cached row = {\n    artistName = \"Ladysmith Black Mambazo\";\n    disabled = 0;\n    persistentID = \"-2511068126837362989\";\n    playing = 0;\n    playlist = \"0x401a7a0 <x-coredata://3A300D46-4B20-46DA-A82E-0785BFFAFF14/OT_Playlist/p62>\";\n    podcast = 0;\n    positionInPlaylist = 0;\n    trackAutoplay = 0;\n    trackEndTime = \"222.563\";\n    trackLoop = 0;\n    trackMaxTime = \"222.563\";\n    trackName = Abezizwe;\n    trackPredelay = 0;\n    trackSignature = 2;\n    trackStartTime = 0;\n    trackTempo = 120;\n    trackVolume = 1;\n} and new database row = {\n    artistName = \"Ladysmith Black Mambazo\";\n    disabled = 0;\n    persistentID = \"-2511068126837362989\";\n    playing = 0;\n    playlist = \"0x40188b0 <x-coredata://3A300D46-4B20-46DA-A82E-0785BFFAFF14/OT_Playlist/p62>\";\n    podcast = 0;\n    positionInPlaylist = 2;\n    trackAutoplay = 0;\n    trackEndTime = \"222.563\";\n    trackLoop = 0;\n    trackMaxTime = \"222.563\";\n    trackName = Abezizwe;\n    trackPredelay = 0;\n    trackSignature = 2;\n    trackStartTime = 0;\n    trackTempo = 120;\n    trackVolume = 1;\n}",
        "NSMergeConflict (0x4018610) for NSManagedObject (0x40dc990) with objectID '0x40deed0 <x-coredata://3A300D46-4B20-46DA-A82E-0785BFFAFF14/OT_Track/p2645>' with oldVersion = 1 and newVersion = 2 and old cached row = {\n    artistName = \"Warren Zevon\";\n    disabled = 0;\n    persistentID = \"-2511068126837362101\";\n    playing = 0;\n    playlist = \"0x401ac40 <x-coredata://3A300D46-4B20-46DA-A82E-0785BFFAFF14/OT_Playlist/p62>\";\n    podcast = 0;\n    positionInPlaylist = 3;\n    trackAutoplay = 0;\n    trackEndTime = \"223.686\";\n    trackLoop = 0;\n    trackMaxTime = \"223.686\";\n    trackName = \"Accidentally Like A Martyr\";\n    trackPredelay = 0;\n    trackSignature = 2;\n    trackStartTime = 0;\n    trackTempo = 120;\n    trackVolume = 1;\n} and new database row = {\n    artistName = \"Warren Zevon\";\n    disabled = 0;\n    persistentID = \"-2511068126837362101\";\n    playing = 0;\n    playlist = \"0x4018420 <x-coredata://3A300D46-4B20-46DA-A82E-0785BFFAFF14/OT_Playlist/p62>\";\n    podcast = 0;\n    positionInPlaylist = 3;\n    trackAutoplay = 0;\n    trackEndTime = \"223.686\";\n    trackLoop = 0;\n    trackMaxTime = \"223.686\";\n    trackName = \"Accidentally Like A Martyr\";\n    trackPredelay = 0;\n    trackSignature = 2;\n    trackStartTime = 0;\n    trackTempo = 120;\n    trackVolume = 1;\n}"
    );
}

self.tracksArray is populated by the following method called from viewWillAppear…

- (BOOL) populateTracksArray    {

    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"OT_Track" inManagedObjectContext:self.managedObjectContext];
    [request setEntity:entity];

    NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"positionInPlaylist" ascending:YES];
    NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
    [request setSortDescriptors:sortDescriptors];
    NSPredicate *fetchPredicate = [NSPredicate predicateWithFormat:@"playlist == %@", currentUserPlaylist];
    [request setPredicate:fetchPredicate];
    [sortDescriptors release];
    [sortDescriptor release];

    NSError *error = nil;
    NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
    if (mutableFetchResults == nil) { // Handle the error.
        return false;
    }

    [self setTracksArray:mutableFetchResults];
    [mutableFetchResults release];
    [request release];

    return true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:13:43+00:00Added an answer on June 1, 2026 at 9:13 am

    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
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, I am using Windows XP. I have multiple hard drives and it
First off, let me say that this is not homework (I am an A-Level
First off, let me say that I am familiar with content_for . It's not
First off i want to say im attempting (and mostly succeeding) to use purely
First off, let me start off that I am not a .net developer. The
I have a feeling that this probably is not possible using strictly CSS, but,
first i want to say that this site has been a really big help
First off, I would like to say that I am just starting with PHP
First off I'm not sure that's the proper title for this question but hopefully
First off let me just say, i dont want anyone to post solutions because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.