ios - Error with core-data -


when add autologin attribute on entity utente code don t work, if delete attribute code work, why??? ps: needed new attribute, can me pls :)

 unresolved error error domain=nscocoaerrordomain code=134100 "the operation couldn’t completed. (cocoa error 134100.)" userinfo=0x10970aae0 {metadata={     nspersistenceframeworkversion = 479;     nsstoremodelversionhashes =     {         utente = ;     };     nsstoremodelversionhashesversion = 3;     nsstoremodelversionidentifiers =     (         ""     );     nsstoretype = sqlite;     nsstoreuuid = "c879290e-f81b-4d22-b6ff-12f34b97820f";     "_nsautovacuumlevel" = 2; }, reason=the model used open store incompatible 1 used create store}, {     metadata =     {         nspersistenceframeworkversion = 479;         nsstoremodelversionhashes =         {             utente = ;         };         nsstoremodelversionhashesversion = 3;         nsstoremodelversionidentifiers =         (             ""         );         nsstoretype = sqlite;         nsstoreuuid = "c879290e-f81b-4d22-b6ff-12f34b97820f";         "_nsautovacuumlevel" = 2;     };     reason = "the model used open store incompatible 1 used create store"; } 

code:

 //caricamento db appdelegate *appdelegate = [[uiapplication sharedapplication] delegate]; nsmanagedobjectcontext *context = [appdelegate managedobjectcontext]; //the error signal here nsentitydescription *entitydesc = [nsentitydescription entityforname:@"utente" inmanagedobjectcontext:context]; nsfetchrequest *request = [[nsfetchrequest alloc] init]; [request setentity:entitydesc];    nsmanagedobject *matches = nil;  nserror *error; nsarray *objects = [context executefetchrequest:request                                           error:&error];  if ([objects count] == 0) {     nslog(@"no email save"); } else {     (int = 0; < [objects count]; i++)     {         matches = objects[i];         //nsmanagedobject *o = objects[i];         //[context deleteobject:o]; //cancella         //[context save:&error];          //email          nslog(@"email salvata : %@",[matches valueforkey:@"email"]);         emailtext.text=[matches valueforkey:@"email"];           //password         nsstring * psw =[matches valueforkey:@"password"];         if (psw)         {             nslog(@"password salvata : %@",[matches valueforkey:@"password"]);             passwordtext.text=[matches valueforkey:@"password"];              //auto-login             nsstring * psw =[matches valueforkey:@"autologin"];             if (psw)             {                 [self login:self];             }         } 

in fact, once deploy app integrates core data, generated model versioned.

if need add new attribute entity, before, need create new version of coredata model, selecting menu " editor -> add model version ", , make changes on entities.

enter image description here

if modifications simple (column deletion, column addition...), coredata can handle lightweight migration not specific code, need keep in project versions of coredata model, enable ios perform migrations existing stores.

all detailed in apple documentation, can found here : https://developer.apple.com/library/ios/documentation/cocoa/conceptual/coredataversioning/articles/introduction.html


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -