title: NSHomeDirectory returns different path each time iPhone App is restarted
body: <p>I noticed that NSHomeDirectory returns a different path each time i restart the App with Xcode, and apparently even if i click the icon manually since it doesn't load the file's contents. I'm stunned that it gives me a different directory each time i restart the app. This happens on both simulator and device and even if i use the "ForUser" method. My calls look like this:</p>
  
  <pre><code>NSString* fullPath = [NSHomeDirectory() stringByAppendingPathComponent:@"test.file"];
  </code></pre>
  
  <p>or</p>
  
  <pre><code>NSString* fullPath = [NSHomeDirectoryForUser(@"MrX") stringByAppendingPathComponent:@"test.file"];
  </code></pre>
  
  <p>or even</p>
  
  <pre><code>NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
  NSString *path = [docsDirectory stringByAppendingPathComponent:@"test.file"];
  </code></pre>
  
  <p>And the log of two app starts looks like this, notice how the GUID part has changed:</p>
  
  <pre><code>loadCharacters: /var/mobile/Applications/ABE7E33E-439B-4258-8FC1-127A3CD00D87/test.file
  loadCharacters: /var/mobile/Applications/71C02507-6347-4693-8CC1-537BE223179E/test.file
  </code></pre>
  
  <p>What am i doing wrong, or what am i missing?</p>
  
  <p><strong>SOLUTION:</strong></p>
  
  <p>At first i was saving to NSHomeDirectory itself, not the "Documents" subdirectory. Since the App directory changes with each deployment but only the files in the "Documents" directory get copied, the saved file was lost after each deployment. Then i used the "Documents" folder but someone suggested i should probably put it in a subfolder of "Documents" i did just that but forgot to create the folder, hence the file wasn't saved. I double-failed on this one. :)</p>
  
  <p>Simply saving to NSHomeDirectory() + "Documents/test.file" works.</p>