Skip to content

executeFetchRequest freezes App #57

@qepic42

Description

@qepic42

I'm using the following code sometimes to deal with data:

NSManagedObjectContext *context = [appDelegate managedObjectContext];

    if (context != nil)
    {
        __block NSArray *objects;

        [context performBlockAndWait:^
         {
             NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"RainbowPonies" inManagedObjectContext:context];

             NSFetchRequest *request = [[NSFetchRequest alloc] init];
             [request setEntity:entityDesc];

             NSError *error;
             objects = [context executeFetchRequest:request error:&error];

             if (error)
             {
                 NSLog(@"err: %@",error);
             }



         }];

        return objects;

    }

Sometimes other apps accessing the same iCloud storage (just on the same device! (example: lite/pro)), then I get randomly a freeze by calling the code. By terminating the other App, the current App starts working again.

Every data-interaction-code runs in performBlockAndWait, so it should not be the problem?

What should I do to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions