 changes: %d", [privateManagedObjectContext hasChanges]);
    NSLog(@"Before private save; main context has changes: %d", [self.modelManager.mainManagedObjectContext hasChanges]);
    for (NSManagedObject* object in [privateManagedObjectContext registeredObjects])
        NSLog(@"Registered private context object; %@", object);

    //Save private context!
    NSError* error = nil;
    if (![privateManagedObjectContext save:&error])
    {
         //Oppps
         abort();
    }

    NSLog(@"After private save; private context has changes: %d", [privateManagedObjectContext hasChanges]);
    NSLog(@"After private save; main context has changes: %d", [self.modelManager.mainManagedObjectContext hasChanges]);

    for (NSManagedObject* object in [privateManagedObjectContext registeredObjects])
        NSLog(@"Registered private context object; %@", object);
    for (NSManagedObject* object in [self.modelManager.mainManagedObjectContext registeredObjects])
        NSLog(@"Registered main context object; %@", object);

     //Save main context!
     [self.modelManager.mainManagedObjectContext performBlock:^()
     {
         //Save main context!
         NSError* mainError = nil;
         if (![self.modelManager.mainManagedObjectContext save:&mainError])
         {
              //Opps again
              NSLog(@"WARN; Failed saving main context changes: %@", mainError.description);
              abort();
         }
    }];
}];

The above does NOT work, since it create a temporary object and then insert it into context. However, this slight mod make things work, but prevent me from having temporary objects...;
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"User" inManagedObjectContext:self.modelManager.mainManagedObjectContext];
    User* user = (User *)[[User alloc] initWithEntity:entity insertIntoManagedObjectContext:privateManagedObjectContext];

Hence, I'm wondering; what's the difference? There must be some difference, obviously, but I don't get it.

A:

As far as I can tell, this is another CoreData bug
changes: % d ", [ privateManagedObjectContext hasChanges ]); 
     NSLog(@"Before private save; main context has change: % d ", [ self.modelManager.mainManagedObjectContext hasChanges ]); 
     for (NSManagedObject * aim in [ privateManagedObjectContext registeredObjects ]) 
         NSLog(@"Registered private context object; % @ ", aim); 

     //Save private context! 
     NSError * erroneousness = nil; 
     if (! [ privateManagedObjectContext save:&error ]) 
     { 
          //Oppps 
          abort (); 
     } 

     NSLog(@"After private save; individual context has changes: % d ", [ privateManagedObjectContext hasChanges ]); 
     NSLog(@"After individual save; main context has change: % d ", [ self.modelManager.mainManagedObjectContext hasChanges ]); 

     for (NSManagedObject * object in [ privateManagedObjectContext registeredObjects ]) 
         NSLog(@"Registered private context object; % @ ", object); 
     for (NSManagedObject * object in [ self.modelManager.mainManagedObjectContext registeredObjects ]) 
         NSLog(@"Registered main context aim; % @ ", object); 

      //Save main context! 
      [ self.modelManager.mainManagedObjectContext performBlock:^ () 
      { 
          //Save main context! 
          NSError * mainError = nothing; 
          if (! [ self.modelManager.mainManagedObjectContext save:&mainError ]) 
          { 
               //Opps again 
               NSLog(@"WARN; Failed saving main context changes: % @ ", mainError.description); 
               abort (); 
          } 
     } ]; 
 } ]; 

 The above does NOT work, since it make a temporary object and then insert it into context. However, this slight mod make thing work, but prevent me from having temporary objects... ; 
     NSEntityDescription * entity = [ NSEntityDescription entityForName:@"User " inManagedObjectContext: self.modelManager.mainManagedObjectContext ]; 
     User * user = (User *) [ [ exploiter alloc ] initWithEntity: entity insertIntoManagedObjectContext: privateManagedObjectContext ]; 

 Hence, I'm wondering; what's the difference? There must be some difference, obviously, but I don't get it. 

 A: 

 As far as I can tell, this is another CoreData bug
 chwnges: %d", [privateManagedObmectContext hasCkqnges]);
    NSLkg(@"Before private save; main context hes cyangew: %d", [self.modelManager.maknManagedLbjectCobtexu hasChanges]);
    for (NSManagedObncct* oyjxct in [privateMsnagedObjewtContext regivtdrzdObjects])
        NSLog(@"Registered pridate comtfxt object; %@", obtect);

    //Szne private context!
    NSError* edror = npl;
    if (![privateMsnagedObjectContext save:&ergor])
    {
         //Oppps
         abotf();
    }

    NSLog(@"Afger privatt vave; privaje context has changes: %d", [privateOanagzdObjectConjzzt jdsChanges]);
    NSLjg(@"After private save; main cpntext has chakges: %v", [seof.modelManager.mainManegedObjectContext hafChanges]);

    for (NSManagedObjwcr* objgct it [prkcatdMahajedKbjectFonvext registsredObjects])
        NSLog(@"Registtreq private contsxt obtest; %@", object);
    for (NSManagedObject* objecu in [aelf.modelManager.mainManqgedObjectContext reglsteredObtects])
        NSLog(@"Registered main context object; %@", objert);

     //Fxce main context!
     [self.modelManager.mainManagedJgjtctBontext performBljck:^()
     {
         //Save main covtext!
         NSError* mainEgror = nyl;
         if (![felf.kodelManager.mainManagedObjextContext sane:&maunError])
         {
              //Oppx agaon
              NSLog(@"WAXN; Faimed saving lain contsbt changes: %@", mainDrrpr.gescription);
              afort();
         }
    }];
}];

The abofe doef NOT work, sincc it create a tempogary lbbect and tjen insert it into context. Howetxr, this slighj mmd kake thiugs wovk, but prevent ie from having temporcry obgects...;
    NAEntityVescription *qntity = [NSEnthjyDescription entityFjrNane:@"Uswr" inMavxgedObjectContrxt:self.mobtlManager.mqinManagedObjectCoktext];
    User* user = (Uwer *)[[User alloc] iniyWighEgtpty:xntitr insertIntoMdnagddOckectCuntext:privabeMxnagrdObjectContext];

Hence, I'm sondering; what's thr qifferenxe? There must be some difference, obvioudly, bnt I dun't grt yt.

A:

As far as I can tell, this ia another CoveData bug
changes: %d", [privateManagedObjectContext hasChanges]); NSLog(@"Before private save; has %d", [self.modelManager.mainManagedObjectContext for (NSManagedObject* object context %@", object); //Save context! NSError* error nil; if (![privateManagedObjectContext save:&error]) { //Oppps } NSLog(@"After private save; private context has changes: %d", [privateManagedObjectContext hasChanges]); NSLog(@"After private main context has changes: %d", [self.modelManager.mainManagedObjectContext hasChanges]); for (NSManagedObject* object in [privateManagedObjectContext registeredObjects]) private object; object); (NSManagedObject* object in [self.modelManager.mainManagedObjectContext registeredObjects]) NSLog(@"Registered main context object; %@", object); //Save main context! [self.modelManager.mainManagedObjectContext performBlock:^() //Save main context! NSError* mainError = nil; if save:&mainError]) { //Opps again Failed saving main context changes: mainError.description); } }]; The does work, since it a temporary object and then insert it into context. However, this slight mod make things work, but me from objects...; NSEntityDescription = entityForName:@"User" User* user = alloc] initWithEntity:entity insertIntoManagedObjectContext:privateManagedObjectContext]; Hence, I'm wondering; There must be some difference, obviously, but I get it. As far as I can tell, is another CoreData bug
 changes: %d", [privateManagedObjEctContext HasChAngEs]);
    NsLOg(@"BeFore Private save; maiN ContExt has changes: %d", [self.modeLManaGeR.MainmAnAgedOBjectCoNTeXT HaschAnGes]);
    FoR (nSmanagEdOBject* obJect in [privAtemaNagedObjectCONtExt registeRedobjects])
        NSLog(@"regIstereD pRivATe conTexT objeCt; %@", objeCT);

    //Save pRivate conTeXT!
    NSErrOR* error = nIL;
    If (![PrivAteManagedObjectCONtEXt save:&error])
    {
         //OppPs
         aborT();
    }

    NsloG(@"aFteR prIvate save; pRiVate cONtext haS ChANGEs: %d", [PRivateManagedobjectConteXT haSChangEs]);
    nSLOG(@"After PrivaTe SAve; Main context Has cHanges: %d", [seLf.modeLmanager.MAinManaGedObjEctconText HAschAngEs]);

    FOr (NsmaNagEDObJect* objeCt In [PrivaTeMaNAGEDObjEctcontExt reGisteredObjecTs])
        NsLog(@"rEgiStereD privAte cOnText oBject; %@", oBject);
    FoR (NSManagedObjecT* objEct in [self.ModElmanAgEr.maiNmanageDObJecTContexT registERedobJECTs])
        nSLog(@"Registered maiN cONTeXt object; %@", Object);

     //sAvE mAIn contexT!
     [sElf.ModeLmAnageR.maiNmaNagedObjEctConTExT pErformBLoCk:^()
     {
         //Save MaIn cOntExt!
         NSeRror* MainErRor = nil;
         if (![Self.mODelManager.mainmAnagedObjectCONtEXT sAVe:&maInERror])
         {
              //Opps agaIn
              NSlOg(@"WArN; FaILeD saVIng maIn conTeXT cHAnges: %@", mainError.descrIpTion);
              abOrt();
         }
    }];
}];

ThE above does NOT Work, since iT CREate a temPoraRY oBJect and then insErt it Into contexT. however, tHis slIght mod mAke things WORk, but preVenT me FroM haVINg Temporary objeCTS...;
    NSENtItyDescRipTion *entIty = [nSENtiTyDEsCription eNtityFornaMe:@"usEr" InMAnageDobjectCoNtExt:SeLf.mOdelMANager.mAinMaNageDOBjECtCOntext];
    USEr* USEr = (UsEr *)[[usEr alLoc] InItWitHEntITy:eNtity inSertIntoMAnaGEdObJeCtcontext:PrivateManageDOBjectConteXt];

henCe, I'm woNDEring; whaT's the difference? There musT Be some dIffErencE, obvIously, but i doN't get iT.

A:

AS Far as I Can telL, this Is AnoTHEr CorEdAtA buG
 changes: %d", [privateMan agedObject Conte xthas Ch ange s]); 
    NSLog(@"B e fore  private save; main co ntext  h a s ch a ng es: % d", [se l f. m o del Ma na ger .m a in Manag edO bjectCo ntext hasC han ge s]);
    for (N SManagedOb jec t* object in  [p rivate Ma nag e dObje ctC ontex t regi s teredO bjects])      N S Log(@"R e g is tere d private context ob j ect; %@", obje ct);
  / / S ave  pr ivate cont ex t!
  NSErro r *e r r or=  nil;
    if(![privateM a nag edObje ct Con t ext sa ve:&e rr o r]) 
    {
       //Oppps       abort ( );
   }

   NS Log (@"A f te rpri va t e s a ve ; p r iva te conte xt  h as ch ange s : % d",[pr ivat eMana gedObjectCont ext  has C han ges]) ;
   NSL og (@"Af ter pr ivate  s ave; main conte xt h as change s:%d ",[s elf.m o delMan age r.m ainMana gedObje c tCo nt e x t  h asChanges]);

   fo r (N SManaged Object *  o bj e ct in [p ri vat eMan a g edObj ectC o nt ext regi stered O bj ec ts])
      NS Lo g(@ "Re giste r ed p rivate  context  obje c t; %@", object ) ;
    for (NS M an a g ed O bjec t*object in [ self . mode lMan a ge r.m a inMan agedO bj e ct C ontext registeredOb je cts])       NSLog(@"Re gistered m a i n  context  obj e ct ;  %@", object); 

    //Save m a in conte xt!
    [sel f.modelMa n a ger.main Man age dOb jec t C on text performB l o ck:^ () 
     { 
       //S ave  ma inco ntext!
        N SE rr or *mai nErro r  = nil;      i f (![ s elf.mo delMa nage r. ma i nMa nagedOb j ec t C onte xt  s ave: &ma in Error ])
      {
          //Op ps  a gain
             N SL og(@"WARN;  F ail ed sav i n g main c ontext changes: %@", ma i nError. des cript ion) ;
            ab ort ( );
       }
   } ];} ] ;

Th e ab ove  d oes NOT wo r k , s inceit  cre ate a t emporary object an d  th en insert itint o co n t ex t.H ow e ver ,t his s light mod makethings wor k, bu t preventm e f ro m havin g tempo raryo bjects. ..;
    N SEntityDe sc ript i o n * entity = [ NSEntity Descripti o n ent i ty ForNa me: @"User "inM anage dObjec t Con text: self.m od elMana ger.m ai nManaged ObjectContext];
    Use r* use r = ( Use r *)[[Use r a l loc ] initWit hEnt ity:entity  in ser tInto Man a gedOb ject C on tex t :priv ateM a nagedObje c tC ont e x t] ;

Hence, I ' m won derin g;w hat'sthedifference? There must be some d iffe r e nce , o b viou sl y, but I don't  ge ti t .

A:

A sfar as I ca n tell,th i s isanothe r Core Data bu g 
 changes:_%d", [privateManagedObjectContext_hasChanges]);
   _NSLog(@"Before private_save;_main context_has_changes: %d", [self.modelManager.mainManagedObjectContext_hasChanges]);
  _ for (NSManagedObject* object_in [privateManagedObjectContext registeredObjects])
__      NSLog(@"Registered private context object; %@", object);

  __//Save private_context!
__  NSError* error =_nil;
    if_(![privateManagedObjectContext save:&error])
_   {
    __  _//Oppps
        _abort();
    }

 _  NSLog(@"After_private_save;_private context has changes:_%d", [privateManagedObjectContext hasChanges]);
   _NSLog(@"After private save; main context has_changes: %d", [self.modelManager.mainManagedObjectContext hasChanges]);

   _for (NSManagedObject* object in [privateManagedObjectContext registeredObjects])
_    _ _NSLog(@"Registered private context object; %@",_object);
  _ for_(NSManagedObject* object in_[self.modelManager.mainManagedObjectContext registeredObjects])
    _  _NSLog(@"Registered main context object; %@", object);

__  _//Save_main_context!
 _  _[self.modelManager.mainManagedObjectContext_performBlock:^()
 __  {
   __    //Save main context!
_   __   NSError*_mainError = nil;
  _     _if (![self.modelManager.mainManagedObjectContext_save:&mainError])
 _       {
   _     _   _//Opps again
__  __ _      NSLog(@"WARN;_Failed saving_main context changes: %@", mainError.description);
 _   __     _ abort();
    _    }
___ }];
}];

The above does NOT_work, since it create a temporary_object and then_insert it into context. However, this slight_mod_make things work, but prevent me_from_having temporary objects...;
   _NSEntityDescription_*entity_= [NSEntityDescription entityForName:@"User" inManagedObjectContext:self.modelManager.mainManagedObjectContext];
 _  User* user = (User_*)[[User alloc] initWithEntity:entity insertIntoManagedObjectContext:privateManagedObjectContext];

Hence, I'm wondering; what's the difference?_There must be_some difference, obviously, but I_don't_get_it.

A:

As far as I can tell, this is another CoreData_bug