iphone - iOS Nested Context slower on Device -


i'm trying move 1 nsmanagedcontext multiple via nested context.

i'm using article me :

actual system

[myhttpclient getpath:path   parameters:@{access_token & stuff}   success:^(afhttprequestoperation *operation, id responseobject) {     (nsdictionary *dictionary in responseobject)     {       // filling dic in nsmanagedobject     }     [mymaincontext save:&error];   }, failure:failureblock]; 

wanted system

[myhttpclient getpath:path   parameters:@{access_token & stuff}   success:^(afhttprequestoperation *operation, id responseobject) {     __block nsmanagedobjectcontext *managedobjectcontext = [(appdelegate *)[[uiapplication sharedapplication] delegate] managedobjectcontext];     __block nsmanagedobjectcontext *writerobjectcontext = [(appdelegate *)[[uiapplication sharedapplication] delegate] writermanagedobjectcontext];     __block nsmanagedobjectcontext *temporarycontext = [[nsmanagedobjectcontext alloc] initwithconcurrencytype:nsprivatequeueconcurrencytype];     temporarycontext.parentcontext = managedobjectcontext;     nsentitydescription *entity = [[self.fetchedresultscontroller fetchrequest] entity];      [temporarycontext performblock:^{       (nsdictionary *dictionary in responseobject)       {         // filling dic in nsmanagedobject       }       [temporarycontext save:&error];       [managedobjectcontext performblock:^{         [managedobjectcontext save:&error];         [writerobjectcontext performblock:^{           [writerobjectcontext save:&error];         }];       }];     }];   }, failure:failureblock]; 

diagram

parent-context diagram

problem

i had problems saving data while using method solved (cf. https://stackoverflow.com/questions/18151827/coredata-writermanagedobjectcontext-freeze-when-save)

however, said in previous question, speed 2 times on simulator it's 5x slower on device. use ipod touch 4th test.

how possible , how can improve ? i'm not against using diagram :

shared persistent store diagram

but want find out how integrate in code because tried , changed nothing.

thank you.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -