title: Record audio and save permanently in iOS
body: <p>I have made 2 iPhone apps which can record audio and save it to a file and play it back again.</p>
  
  <p>One of them uses AVAudiorecorder and AVAudioplayer.
  The second one is Apple's <a href="http://developer.apple.com/library/ios/samplecode/SpeakHere/Introduction/Intro.html" rel="noreferrer">SpeakHere</a> example with Audio Queues.</p>
  
  <p>Both run on Simulater as well as the Device.</p>
  
  <p>BUT when I restart either app the recorded file is not found!!!
  I've tried all possible suggestions found on stackoverflow but it still doesnt work!</p>
  
  <p>This is what I use to save the file:</p>
  
  <pre><code>NSArray *dirPaths; 
  NSString *docsDir; 
  
  dirPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); 
  docsDir = [dirPaths objectAtIndex:0]; 
  
  NSString *soundFilePath = [docsDir stringByAppendingPathComponent:@"sound1.caf"]; 
  NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
  </code></pre>