title: What to do when the user enables or disables the iCloud support in the app Settings Bundle?
body: <p>I am targeting <strong>iOS7</strong> and I use <strong>iCloud</strong> with an <code>UIManagedDocument</code>. I would like to know what to do in these two cases:</p>
  
  <p>1) <strong><em>First case: App first launch</em></strong></p>
  
  <p>It's the first launch, when we do not know yet if the user wants to use iCloud or not and we should assume he doesn't want to use it until we ask him. Once we'll find out, his choice will be stored in the app Settings Bundle and he will be able to change his mind later.</p>
  
  <p>When my app launch, the first view that appears triggers the UIManagedDocument init with <code>[[UIManagedDocument alloc] initWithFileURL:url]</code>. It does this because it should know how many rows it has to display in its table.</p>
  
  <p>At this point, it is the first launch, and I still have to ask to the user, I assume he does not want to use iCloud so the UIManagedDocument is initialized without the <code>persistentStoreOptions</code> set (<code>NSPersistentStoreUbiquitousContentNameKey</code> and <code>NSPersistentStoreUbiquitousContentURLKey</code>).</p>
  
  <p>The file is then created on the disk with </p>
  
  <pre><code>[UIManagedDocument saveToURL: URL 
              forSaveOperation: UIDocumentSaveForCreating 
             completionHandler: ^(BOOL success){
  
              if(success){
                //Do something with the document
              }
  
             }];
  </code></pre>
  
  <p>then the view appears. Since it is the first launch, I should ask the user if he wants to use iCloud or not.</p>
  
  <p>I show an <code>UIAlertView</code> from <code>[viewDidAppear:animated]</code></p>
  
  <p>If he answers "<strong><em>NO</em></strong>", everything is already ok. But what should I do if he says "<strong><em>YES</em></strong>"?? </p>
  
  <p>Should I close the <code>UIManagedDocument</code> and migrate the DB or is it enough to set the <code>NSPersistentStoreUbiquitousContentNameKey</code> and <code>NSPersistentStoreUbiquitousContentURLKey</code> in the document's <code>persistentStoreOptions</code>?</p>
  
  <p>2) <strong><em>Second case: a couple of days later the user changes his mind</em></strong></p>
  
  <p>The user did choose to enable iCloud but after some day he changes his mind. He switches to NO the iCloud option in the app settings bundle. When the app launches I check for a change in this option and I find that it has switched from YES to NO. As I understood from the hints I got on SO, the correct path should be to display an UIAlertView asking him if he wants:</p>
  
  <p>a) Keep the documents on the device</p>
  
  <p>b) Delete the documents from the device</p>
  
  <p>c) Keep using iCloud</p>
  
  <p>What should i do for the options a) and b)? 
  A DB migration for option a) and recreate the DB from zero for option b)?</p>