iphone - Coredata Remove and Read Relationship -
is possible remove , read relationship?
i cannot post code here since huge project complex process.
let's have tablea <-->> tableb tableb gets updated (i.e., tableb objects deleted , new obejcts (re)added). check if objects tablea had relationship tableb, have in array server object id. read data in tableb , readd relationship. relationship gets faulted , cannot accessed. after add or remove object save it. doing wrong?
i feel misunderstanding intentions here give try , modify needed. first, entities should start capital letter, using tablea
, tableb
entities. tablea
, tableb
terrible names coredata entities. atrociously generic , if ever decide use them outside of tables confuse code. since "huge project complex process."
this in essence believe seeking:
// defined elsewhere nsmanagedobjectcontext *managedobjectcontext; // saving the object want connect later tablea *relationshiptoa = self.alltablebs.tablearelationship; // remove tableb objects coredata doing // ... // // // // insert new tableb objects setting tablearelationship relationshiptoa // ... // // // single example tableb *bobject = [nsentitydescription insertnewobjectforentityforname:@"tableb" inmanagedobjectcontext:managedobjectcontext]; bobject.tablearelationship = relationshiptoa; // save context
then when attempt access objects relationship tablea valid , vice versa.
Comments
Post a Comment