title: Write data to file Cocoa?
body: <p>I need to use the  <code>writeToFile:</code> methods in writing data (that is encrypted) to a file. However, say I have:</p>
  
  <pre><code>NSData *encryptedData = [data AES256EncryptWithKey:key];
  </code></pre>
  
  <p>And I write the encryptedData to a file by:</p>
  
  <pre><code>[encryptedData writeToFile:@"file.txt" automatically:YES];
  </code></pre>
  
  <p>This for some reason does not write the data to "file.txt." This is a very simple question and I know I am missing something super basic. If file.txt is not actually there, it must be created.</p>