3

I'm working with new version of Magical Records and have a problem. Method of MR_contextForCurrentThread is deprecated, i want to find new context instead of that, but without success, i am always have error. I'm already tried simple MR_Context and MR_rootSavingContext. What method is better to use in async mode ?

dispatch_async(_syncQueue, ^{
        __unused YOUServerObject *o;

        NSManagedObjectContext *moc = [NSManagedObjectContext MR_contextForCurrentThread];
        [moc reset];
        [moc performBlockAndWait:^{

                NSArray *objects = [array bk_map:^id(NSDictionary *dict) {
                   // fetching from core data by path and id           
                    return object;
                }];

                for (NSUInteger i = 0; i < array.count; ++i)
                {
                    // sync relationshipsYOUSyncableServerObject in core data 
                    // obj.syncDateTime = syncDate;
                }
                        [moc MR_saveWithOptions:MRSaveSynchronously | MRSaveParentContexts
                                     completion:^(BOOL contextDidSave, NSError *error) {
                           // saving inside core data
                             }];
                        }
user3312949
  • 145
  • 1
  • 9
  • https://stackoverflow.com/questions/20535419/what-is-the-replacement-method-for-this-magicalrecord-deprecated-call/37497974 Just in case :) – Fawkes Mar 08 '18 at 17:08

0 Answers0