title: iOS data loss after update
body: <p>My problem is that I have experienced data loss from NSUserDefaults and from Core Data after updating application. I that possible because of wrong path to NSDocumentsDirectory. Right now current path is acquired this way</p>
  
  <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  return [NSURL fileURLWithPath:[paths objectAtIndex:0]];
  </code></pre>
  
  <p>or should it be done this way</p>
  
  <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  return [NSURL fileURLWithPath:[paths lastObject]];
  </code></pre>