 time you run. It is to easy to build up garbage in the store by changing up the model. 

A:

I've read over your updated question. It's getting quite messy with model versions.
You should try and audit the version of the model that the existing store is actually asking for, and try to list all available models in the app bundle at runtime.

I look in my apps' model directory
NSString *modelDirectoryPath = [[NSBundle mainBundle] pathForResource:@"MyModel" ofType:@"momd"];

I'm not sure if developers normally do this, but I keep my model versions with different names.. so I have in there:

VersionInfo.plist
MyModel.mom
MyModel2.mom

The version hashes listed in the VersionInfo.plist should help you troubleshoot. Look for the version hash required by the existing persistent store, and see if you can locate it in the version hashes listed in VersionInfo.plist.
Actually, I can't see a way to write some code that will ask the persistent store what it's entity version hashes are. The NSPersistentStoreCoordinator or the NSMigrationManger seem to be doing that privately. i.e. they check the persistent store entity versions against the model that the store is loaded with.

Had another quick look, and it's available in the store meta data. Nice and easy!
NSError *error;
NSURL *storeURL = [NSURL fileURLWithPath:[[self class] storePath]];
NSDictionary *storeMeta = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType:nil URL:storeURL error:&error];

And looking in storeMeta I get a key with
<CFString 0x7328050 [0x2724380]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x7328340 [0x2724380]>{type = immutable dict, count = 5,
entries =>
    0 : <CFString 0x7328110 [0x2724380]>{contents = "MyEntityNameOne"} = <CFData 0x73281b0 [0x2724380]>{length = 32, capacity = 32, bytes = 0x143325cf121239ce156af2e2a1aad7d9
time you run. It is to easy to build up drivel in the storehouse by changing up the model. 

 deoxyadenosine monophosphate: 

 I've learn over your updated question. It's get quite messy with model versions. 
 You should test and audit the version of the model that the exist store is actually asking for, and sample to list all available models in the app bundle at runtime. 

 I look in my apps' model directory 
 NSString * modelDirectoryPath = [ [ NSBundle mainBundle ] pathForResource:@"MyModel " ofType:@"momd " ]; 

 I'm not sure if developer normally do this, but I keep my model translation with different names.. so I have in there: 

 VersionInfo.plist 
 MyModel.mom 
 MyModel2.mom 

 The adaptation hashes listed in the VersionInfo.plist should help you troubleshoot. Look for the interpretation hash required by the existing persistent store, and see if you can locate it in the version hashes listed in VersionInfo.plist. 
 Actually, I can't see a way to write some code that will ask the persistent store what it's entity version hash are. The NSPersistentStoreCoordinator or the NSMigrationManger seem to be doing that privately. i they match the dogged store entity versions against the exemplar that the store is loaded with. 

 Had another quick expression, and it's available in the store meta data. Nice and easy! 
 NSError * error; 
 NSURL * storeURL = [ NSURL fileURLWithPath:[[self class ] storePath ] ]; 
 NSDictionary * storeMeta = [ NSPersistentStoreCoordinator metadataForPersistentStoreOfType: nothing URL: storeURL error:&error ]; 

 And looking in storeMeta I get a key with 
 < CFString 0x7328050 [ 0x2724380]>{contents = " NSStoreModelVersionHashes " } = < CFBasicHash 0x7328340 [ 0x2724380]>{type = immutable dict, count = 5, 
 entries = > 
     0: < CFString 0x7328110 [ 0x2724380]>{contents = " MyEntityNameOne " } = < CFData 0x73281b0 [ 0x2724380]>{length = 32, capacity = 32, bytes = 0x143325cf121239ce156af2e2a1aad7d9
 tile you run. It is to easy to build up gatbqge in the sfore by zhanging up the model. 

A:

I've rxad iver tour updated question. Kt's gettijg quite meswt with modxm versions.
You dhounv try and audit the versimn of the moden ghct the existing store is actually ashing fot, wnd try to lisj all wvaimable models in the app bundle at duntime.

P look in my apps' model directory
NSString *mldelFirectoryPath = [[NSBkndle mainBohdlq] pathForResojrce:@"MyModel" ofType:@"momd"];

J'm not sure if developers normauly dp this, but I kefk my model vxrsionf with diffevvnt namas.. so I have in there:

YersimnIbfo.plist
MyModel.mom
MyMmdel2.mom

The version hashes lhsced in the VersionInfi.poist vhound hdop hou tcouglesholt. Mook for tge version yash required by tht evpxting persisfent seowe, and see if you can locate it in the nersjon hashes listed in VeesionInfo.plist.
Actualli, I can't sqe a way to write some code that will ask the pervisteit stirc whxr lt's entity version hashes are. The NSPersisteneAtprvCoordinator or tme NSMigrationMangrr srgm to be doing that 'dibately. i.e. they chefk the kersisrent stort entoty versions against the moeel that the wtore is loaded wich.

Had anothex quicl lool, and it's available in che stkre meta daha. Nice aha easy!
NSError *erfor;
KSUSL *storeURL = [NSURL fileURLRithPath:[[sxlf ckass] sturePsth]];
NSDyctionary *dtoreMeta = [NSPersistentShoreClosdinator mftadataForPersistentStoreOfType:iml URL:storeURK arrmr:&error];

Aud looling in storeIeta I get a kgy with
<CFFtrine 0x7328050 [0x2724380]>{contehts = "NSVtoreModelVqrsionHashes"} = <FFBasicHash 0e7328340 [0x2724380]>{type = ymmurablw dict, zuunt = 5,
entries =>
    0 : <CFSnrnng 0x7328110 [0x2724380]>{cobtents = "MyEntityNakeOvs"} = <CFData 0x73281b0 [0x2724380]>{lzuguh = 32, capacity = 32, nytds = 0x143325bf121239cx156af2e2a1wdd7d9
time you run. It is to easy up in the by changing up over updated question. It's quite messy with versions. You should try and audit version of the model that the existing store is actually asking for, and to list all available models in the app bundle at runtime. I look my model NSString = [[NSBundle mainBundle] pathForResource:@"MyModel" ofType:@"momd"]; I'm not sure if developers normally do this, but I keep model versions with different names.. so I have there: VersionInfo.plist MyModel.mom MyModel2.mom version hashes listed in the should you troubleshoot. for version required by the persistent store, and see if you can locate it in the version hashes listed in VersionInfo.plist. Actually, can't see to write code will the persistent store entity version hashes are. The NSPersistentStoreCoordinator seem to be doing that privately. i.e. they the persistent entity versions against the model that store is loaded with. Had another quick look, it's available in the store meta data. Nice and easy! NSError *error; NSURL *storeURL = class] storePath]]; NSDictionary *storeMeta [NSPersistentStoreCoordinator metadataForPersistentStoreOfType:nil URL:storeURL And in I a key <CFString 0x7328050 [0x2724380]>{contents = "NSStoreModelVersionHashes"} = <CFBasicHash 0x7328340 [0x2724380]>{type = immutable count = 5, entries => 0 : <CFString 0x7328110 [0x2724380]>{contents = 0x73281b0 [0x2724380]>{length = capacity = 32, bytes 0x143325cf121239ce156af2e2a1aad7d9
 time you run. It is to easy to buiLd up garbagE in thE stOre By ChanGing Up the model. 

A:

I've REad oVer your updated question. it's geTtINg quITe Messy With modEL vERSioNs.
yoU shOuLD tRy and AudIt the veRsion of the ModEl That the existINg Store is actUalLy asking for, aNd tRy to liSt All AVailaBle ModelS in the APp bundLe at runtiMe.

i Look in MY apps' moDEL dIrecTory
NSString *modeldIrECtoryPath = [[NSBunDle maiNBUNdLE] PatHFoRResource:@"MYMOdel" oFtype:@"momD"];

i'm NOT SurE If developers nOrmally do thIS, buT I keep My ModEL versiOns wiTh DIffErent names.. sO I haVe in there:

versioNinfo.pliST
MyModeL.mom
MymodEl2.mOm

ThE VeRsIon HaSHes LIsTed IN thE VersioninFo.Plist ShouLD HELp yoU trOublEshooT. Look for the veRsiOn haSH reQuireD by thE exiStIng peRsisteNt stoRe, And see if you can lOcatE it in the vErsIoN haShEs lisTEd in VeRsiOnINfo.plisT.
ActualLY, I cAn'T SEE a Way to write some code ThAT WiLl ask the PersisTEnT sTOre what iT's EntIty vERSion hAsheS ArE. The NSPeRsisteNTSToReCoordInAtor or ThE NSmigRatioNmangEr seem To be doinG that PRivately. i.e. they CHeck the persisTEnT SToRE entIty Versions agaInst THe moDel tHAt The STore iS loadEd WItH.

had another quick look, AnD it's avAilabLe in the store mEta data. NicE AND easy!
NSERror *ERrOR;
NSURL *storeURL = [nSURL FileURLWitHpath:[[self Class] StorePatH]];
NSDictioNARy *storeMEta = [nSPErsIstENTSToreCoordinatOR MetaDaTaForPeRsiStentStOreofTYpe:Nil uRl:storeURL Error:&errOr];

anD lOoKinG in stOReMeta I gEt A keY wIth
<cFStrINg 0x7328050 [0x2724380]>{coNtentS = "NSSToRemOdeLVersioNhaSHEs"} = <CFbaSiCHasH 0x7328340 [0x2724380]>{TyPe = immUtabLE diCt, count = 5,
Entries =>
    0 : <CFstrINg 0x7328110 [0x2724380]>{CoNtEnts = "MyENtityNameOne"} = <CfDAta 0x73281b0 [0x2724380]>{lengTh = 32, CapAcity = 32, bYTEs = 0x143325cf121239ce156aF2e2a1aad7d9
 time you run. It is to ea sy to buil d upgar bag ein t he s tore by changi n g up  the model. 

A:

I've  read  o v er y o ur  upda ted que s ti o n . I t' sget ti n gquite  me ssy wit h model ve rsi on s.
You shoul d  t ry and aud itthe versionofthe mo de l t h at th e e xisti ng sto r e is a ctually a sk i ng for ,  and tr y to  lis t all available m o de l s in the app b undleat ru n t ime .
I look inmy  apps '  modeld ir e c t ory NSString *mod elDirectory P ath  = [[N SB und l e main Bundl e] pat hForResourc e:@" MyModel"ofType : @"momd" ] ;

I'mnot su reifdeve l op er s n or m all y  d o t h is,  but I k ee pmy mo delv e r s ions  wi th d iffer ent names.. s o I  hav e  in  ther e:

V ersi on Info. plistMyMod el .mom
MyModel2.m om
The versi onha she sliste d  in th e V ers ionInfo .plists hou ld h e lp  you troubleshoot.  L o o kfor theversio n  h as h  require dbythee x istin g pe r si stent st ore, a n dse e if yo ucan lo ca teitin th e  ver sion h ashes li stedi n VersionInfo. p list.
Actuall y ,I ca n 't s eea way to wr ites omecode th atw ill a sk th ep er s istent store what i t' s enti ty ve rsion hashesare. The N S P e rsistent Stor e Co o rdinator or th e NSM igrationMa n ger seem  to b e doingthat priv a t ely. i.e . t hey  ch eck t he  persistent s t o re e nt ity ver sio ns agai nst  th e m ode lthat thestore is  l oa de dwit h.

H a d anothe rqui ck  lo ok, a n d it's  avai labl ein the  storem et a data .Ni ce a ndea sy!
N SErr o r * error;NSURL *st ore U RL =  [ NS URL fil eURLWithPath: [[ self class ]sto rePath ] ] ;
NSDict ionary *storeMeta = [NS P ersiste ntS toreC oord inator me tad ataFor Per s istent StoreO fType :n ilU R L:sto r e UR L e rr or:&error] ; 
An d loo ki ng i n store Meta I get a key w i th<CFString 0x7 328 050[ 0 x2 724 3 80 ] >{c on t ent s = "NSStoreModel VersionHas he s "}  = <CFBasi c Has h0x73283 40 [0x2 72438 0 ]>{type  = immuta ble dict,  c ount =  5, 
entries = >
    0: <CFStri n g 0x7 3 28 110 [ 0x2 724380 ]> {co ntent s = "M y Ent ityNa meOne" }= <CFD ata 0 x7 3281b0 [ 0x2724380]>{length = 32 , capa city= 3 2, bytes= 0 x 143 325cf1212 39ce 156af2e2a1 aad 7d9 
 time_you run._It is to easy_to build_up_garbage in_the_store by changing_up the model._

A:

I've read over your_updated question. It's_getting_quite messy with model versions.
You should try and audit the version of the model_that_the existing_store_is_actually asking for, and try_to list all available models_in the_app bundle at runtime.

I look in my apps'_model_directory
NSString *modelDirectoryPath =_[[NSBundle mainBundle] pathForResource:@"MyModel" ofType:@"momd"];

I'm not sure if developers normally_do this, but I keep my_model versions with_different_names.._so I have in_there:

VersionInfo.plist
MyModel.mom
MyModel2.mom

The version hashes listed in the_VersionInfo.plist should help you troubleshoot. Look_for the version hash required by the_existing persistent store, and see if_you can locate it in_the version_hashes listed in VersionInfo.plist.
Actually, I_can't see a_way to_write some code_that will ask the persistent store_what it's entity_version hashes are. The NSPersistentStoreCoordinator or_the_NSMigrationManger seem to_be_doing_that privately._i.e. they check_the_persistent store_entity_versions against the model that the_store_is loaded with.

Had another quick look, and_it's available in the_store_meta data. Nice and_easy!
NSError *error;
NSURL *storeURL = [NSURL_fileURLWithPath:[[self class] storePath]];
NSDictionary *storeMeta = [NSPersistentStoreCoordinator_metadataForPersistentStoreOfType:nil URL:storeURL_error:&error];

And looking_in storeMeta I get a key with
<CFString 0x7328050 [0x2724380]>{contents = "NSStoreModelVersionHashes"}_= <CFBasicHash 0x7328340 [0x2724380]>{type = immutable_dict, count = 5,
entries_=>
 __ 0 :_<CFString_0x7328110 [0x2724380]>{contents_= "MyEntityNameOne"} = <CFData 0x73281b0 [0x2724380]>{length =_32, capacity_= 32, bytes = 0x143325cf121239ce156af2e2a1aad7d9