Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


background save cause fetch not working #210

caiguo37 opened this Issue · 4 comments

3 participants

dispatch_async(retrieve_queue(), ^{
    ASIHTTPRequest *roomRequest = //code to genrate the request;
    [roomRequest startSynchronous];
    if (!roomRequest.error)
        [MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext) {
            // code to parse the data

After the parse finish,every room will have at least on message. But the FRC just not return any result even if the is one message in that room and the status is > 0.

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(rid == %@) AND (status >= 0)", _room];
_fetchControllerForHistory = [Message MR_fetchAllSortedBy:@"serverDatetime,index" ascending:YES withPredicate:predicate groupBy:nil delegate:self];
NSLog(@"%i,%i",_room.mids.count, self.fetchControllerForHistory.fetchedObjects.count);

This only happen when BACKGROUND SAVE happened.

NSManagedObjectContext *localContext = [NSManagedObjectContext MR_contextForCurrentThread];
[localContext performBlockAndWait:^{
   // code to parse the data
    [localContext MR_save];

If I do the parse like this,the FRC can return the right data,but the data is not saved persistently.


I think this is due to the issue describes here.


Working on a fix for this.

@blackgold9 blackgold9 closed this

SHould be fixed now. Please re-open if not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.