iphone - NSInternalInconsistencyException ( error during execution of SQL string 'INSERT INTO Y_UBMETA(YPEERID, YTRANSACTIONNUMBER) ) -


ios icloud

terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'error during execution of sql string 'insert y_ubmeta(ypeerid, ytransactionnumber)

unresolved error error domain=nscocoaerrordomain code=134312 "store metadata recovery appears have failed, please try adding store coordinator again. if unsuccessful, migrate data new ubiquitized persistent store." userinfo=0xdba5b80 {nslocalizeddescription=store metadata recovery appears have failed, please try adding store coordinator again. if unsuccessful, migrate data new ubiquitized persistent store.}, {    nslocalizeddescription = "store metadata recovery appears have failed, please try adding store coordinator again. if unsuccessful, migrate data new ubiquitized persistent store.";

how solve problem? coz internal query icloud. putting code block below of method have written..

 - (nspersistentstorecoordinator *)persistentstorecoordinator {     nslog(@"persistentstorecoordinator:%@",[persistentstorecoordinator_ description]);     if((persistentstorecoordinator_ != nil))     {         return persistentstorecoordinator_;     }     nslog(@"persistentstorecoordinator:%@",[persistentstorecoordinator_ description]);     nsurl *storeurl = [[self applicationdocumentsdirectory] urlbyappendingpathcomponent:@"coredatamodel.sqlite"];     persistentstorecoordinator_ = [[nspersistentstorecoordinator alloc] initwithmanagedobjectmodel:[self managedobjectmodel]];     nspersistentstorecoordinator* psc = persistentstorecoordinator_;     nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];                         dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{         nsfilemanager *filemanager = [nsfilemanager defaultmanager];         // migrate datamodel         nsdictionary *options = nil;         // needs match entitlements , provisioning profile         nsurl *cloudurl = [filemanager urlforubiquitycontaineridentifier:nil];         nslog(@"cloudurl:%@",cloudurl);             //nsstring* coredatacloudcontent = [[cloudurl path] stringbyappendingpathcomponent:@"data"];                          cloudurl = [cloudurl urlbyappendingpathcomponent:@"data"];                                                                                                                                          // nslog(@"coredatacloudcontent:%@",coredatacloudcontent);        //if ([coredatacloudcontent length] != 0 && [[defaults objectforkey:@"allmetadataflag"] isequaltostring:@"yes"])                    if (cloudurl )//&& [[defaults objectforkey:@"allmetadataflag"] isequaltostring:@"yes"])                     {             // icloud available            // cloudurl = [nsurl fileurlwithpath:coredatacloudcontent];             nslog(@"cloudurl:%@",cloudurl);             options = [nsdictionary dictionarywithobjectsandkeys:                        [nsnumber numberwithbool:yes], nsmigratepersistentstoresautomaticallyoption,                        [nsnumber numberwithbool:yes], nsinfermappingmodelautomaticallyoption,                        @"secureassistant.store", nspersistentstoreubiquitouscontentnamekey,                        cloudurl, nspersistentstoreubiquitouscontenturlkey,nil];         }         else         {             // icloud not available             options = [nsdictionary dictionarywithobjectsandkeys:                        [nsnumber numberwithbool:yes], nsmigratepersistentstoresautomaticallyoption,                        [nsnumber numberwithbool:yes], nsinfermappingmodelautomaticallyoption,nil];         }             nserror *error = nil;         [psc lock];         if (![psc addpersistentstorewithtype:nssqlitestoretype configuration:nil url:storeurl options:options error:&error])         {             nslog(@"unresolved error %@, %@", error, [error userinfo]);             abort();         }         [psc unlock];         dispatch_async(dispatch_get_main_queue(), ^{             nslog(@"asynchronously added persistent store!");             [[nsnotificationcenter defaultcenter] postnotificationname:@"refetchalldatabasedata" object:self userinfo:nil];         });     });        return persistentstorecoordinator_; } 

i have got same issue, happened because have changed attribute of datamodel xcode, not app code. solved delete sqlite file icloud , deleted app device rebuild. worked me.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -