ios - MagicalRecord : how to perform background saves -


i building news application, fetches data distant server, using afnetworkoperation (all operations put in nsoperationqueue in order manage synchronisation process , progress).

each completion block of each afnetworkoperation creates/deletes/updates core data entities.

at whole end of synchronisation process, in order make changes persistent, perform full save following lines of code

    dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_background, 0);      dispatch_async(queue, ^{          nslog(@"saveinbackground : starting...");           [[nsmanagedobjectcontext defaultcontext] savetopersistentstorewithcompletion:^(bool success, nserror *error) {               nslog(@"saveinbackground : finished!");          }];     }); 

unfortunately blocks main thread during save operation.

i might not use magicalrecord , advice welcome.

after digging deeper inside magicalrecord, seems code working , not block main thread @ all.

my issue not on magicalrecord, on way should use on completion blocks of afnetworking operation.

i start new discussion provide full details on it.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -