ios - Static Framework Issue: +entityForName: could not locate an entity named 'APIContent' in this model -
can please me understand how fix issue ? attempting add magical record along coredata database inside static framework can use across multiple projects.
the exception following:
+entityforname: not locate entity named 'apicontent' in model.
please code being ran within model below:
(void) insertorupdate:(nsdictionary *) objectdictionary { @try { nsmanagedobjectcontext *localcontext = [nsmanagedobjectcontext mr_contextforcurrentthread]; apicontent *product; // check if object exists nspredicate *predicate = [nspredicate predicatewithformat:@"id == %@", [objectdictionary objectforkey:@"id"]]; product = [apicontent mr_findfirstwithpredicate:predicate incontext:localcontext]; bool objectidnotfound = product == nil ? true: false; if (objectidnotfound) { product = [apicontent mr_createincontext:localcontext]; } // import values nsdictionary object [product mr_importvaluesforkeyswithobject:objectdictionary]; [localcontext savetopersistentstorewithcompletion:^(bool success, nserror *error) { if (success) { ddlogcinfo(@"object saved successfully."); } else { ddlogerror(@"object not saved successfully"); } }]; } @catch (nsexception *exception) { ddlogerror(@"class: %@ function: %s @ line: %d \n exception: %@", [self class], func, line, exception); } }
thanks, michael
may here problem bundle? try load nsmanagedobjectmodel
using method:
[magicalrecord setdefaultmodelfromclass:[self class]];
i got same error when implementing unit test coredata.