ios - Remove Core Data from iCloud fails -


i'm trying remove core data icloud using [nspersistentstorecoordinator removeubiquitouscontentandpersistentstoreaturl:options:error:]. strange output:

__93+[nspersistentstorecoordinator removeubiquitouscontentandpersistentstoreaturl:options:error:]_block_invoke(1982): coredata: ubiquity:  unable move content directory new location: file:///private/var/mobile/library/mobile%20documents/<ubiquity_id>/     new: file:///private/var/mobile/library/mobile%20documents/oldubiquitouscontent-mobile~c9439ad0-1e87-4977-9c68-0674f5e2e93b error domain=nscocoaerrordomain code=513 "the operation couldn’t completed. (cocoa error 513.)" userinfo=0x181ab790 {nssourcefilepatherrorkey=/private/var/mobile/library/mobile documents/<ubiquity_id>,      nsuserstringvariant=(     move ), nsfilepath=/private/var/mobile/library/mobile documents/<ubiquity_id>, nsdestinationfilepath=/private/var/mobile/library/mobile documents/oldubiquitouscontent-mobile~c9439ad0-1e87-4977-9c68-0674f5e2e93b, nsunderlyingerror=0x181aab50 "the operation couldn’t completed. operation not permitted"} 

what mean?

how avoid it? i'm working on icloud disable/enable feature. details here

update:

  nsdictionary *icloudoptions =   [nsdictionary dictionarywithobjectsandkeys:kicloudcontentnamekey, nspersistentstoreubiquitouscontentnamekey,    icloudurl, nspersistentstoreubiquitouscontenturlkey, nil];  // self.lasticloudstoreurl stores nspersistentstore.url after stack setup   bool result = [nspersistentstorecoordinator removeubiquitouscontentandpersistentstoreaturl:self.lasticloudstoreurl                                                                                      options:icloudoptions                                                                                        error:&error]; 

normally (before ios7), take ubiquitouscontenturl value [filemanager urlforubiquitycontaineridentifier:nil]; , pass option called nspersistentstore ubiquitouscontenturlkey, , how icloud know keep of data in icloud account.

in ios 7 , mac os x don't need pass value @ all, , apple call urlforubiquitous containeridentifier automatically under hood you.

so solution looks this:

nsdictionary *options = [nsdictionary dictionarywithobjectsandkeys:kicloudcontentnamekey, nspersistentstoreubiquitouscontentnamekey, nil]; nsurl *storeurl = [nspersistentstore mr_urlforstorename:[magicalrecord defaultstorename]]; bool result = [nspersistentstorecoordinator removeubiquitouscontentandpersistentstoreaturl:storeurl options:options error:&error]; 

i suggest check wwdc 2013 session 207 things clearly.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -