title: Operation could not be completed. AVAudioRecorder iphone SDK
body: <p>I am trying to record using the iphones microphone: This is my code:</p>
  
  <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentsDirectory = [paths objectAtIndex:0];
  
  // the path to write file
  NSString *appFile = [documentsDirectory stringByAppendingPathComponent:@"testing.mp3"];
  
  
  
  
  NSURL *url = [NSURL fileURLWithPath:appFile isDirectory:NO];
  
  NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
                            [NSNumber numberWithFloat: 44100.0],                 AVSampleRateKey,
                            [NSNumber numberWithInt: kAudioFormatMPEGLayer3], AVFormatIDKey,
                            [NSNumber numberWithInt: 1],                         AVNumberOfChannelsKey,
                            [NSNumber numberWithInt: AVAudioQualityLow],         AVEncoderAudioQualityKey,
                            nil];
  
  NSError *error;
  
  recorder = [[AVAudioRecorder alloc] initWithURL:url settings:settings error:&amp;error];
  
  if ([recorder prepareToRecord] == YES){
      [recorder record];
  }else {
      int errorCode = CFSwapInt32HostToBig ([error code]); 
      NSLog(@"Error: %@ [%4.4s])" , [error localizedDescription], (char*)&amp;errorCode); 
  
  }
  
  NSLog(@"BOOL = %d", (int)recorder.recording);
  </code></pre>
  
  <p>This is the error I get:</p>
  
  <pre><code>Operation could not be completed. (OSStatus error 1718449215.)
  </code></pre>
  
  <p>And I can not work out why this doesn't work, as a lot of the code I got from a website.</p>
  
  <p>Jonathan</p>