title: AudioFileOpenURL causes error -43 can't open file on simulator, but not device
body: <p>I'm using AudioFileOpenURL to access an audio file. It works fine on my device, but not in the simulator. Here is where the error is being thrown:</p>
  
  <pre><code>        XThrowIfError(AudioFileOpenURL (sndFile, kAudioFileReadPermission, 0/*inFileTypeHint*/, &amp;mAudioFile), "can't open file");
  </code></pre>
  
  <p>Any possible ideas why this might be?</p>
  
  <hr>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>Here are my printouts of sndFile on the simulator and then on the device:</p>
  
  <pre><code> SIMULATOR
   2011-04-13 12:20:10.259 iMC[51887:207] CreateQueueForFile       /var/folders/u6/u6pKbm2MFriwajkdt-OQME+++TI/-Tmp-/LoopExtended.wav
   2011-04-13 12:20:10.322 iMC[51887:207] sndFile  file://localhost/var/folders/u6/u6pKbm2MFriwajkdt-OQME+++TI/-Tmp-/LoopExtended.wav
   Error: can't open file (-43)
  2011-04-13 12:20:10.323 iMC[51887:207] URL:                      /var/folders/u6/u6pKbm2MFriwajkdt-OQME+++TI/-Tmp-/LoopExtended.wav 
  
  
  
  
  DEVICE 
  2011-04-13 12:21:07.829 iMC[3061:307] CreateQueueForFile        /private/var/mobile/Applications/16194CBB-F0B3-4D39-9655-8FD67C247D74/tmp/LoopExtended.wav
  2011-04-13 12:21:07.846 iMC[3061:307] sndFile   file://localhost/private/var/mobile/Applications/16194CBB-F0B3-4D39-9655-8FD67C247D74/tmp/LoopExtended.wav
  2011-04-13 12:21:07.859 iMC[3061:307] URL:                      /private/var/mobile/Applications/16194CBB-F0B3-4D39-9655-8FD67C247D74/tmp/LoopExtended.wav 
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT 2</strong></p>
  
  <pre><code>void AQPlayer::CreateQueueForFile(CFStringRef inFilePath) 
  {   
  
  // printf("CreateQueueForFile called \n ");
  
  NSString *local_recordFilePath_NSString = (NSString *)inFilePath;
  NSLog(@"CreateQueueForFile %@", local_recordFilePath_NSString );
  
  
  
  CFURLRef sndFile = NULL; 
  
  try {                   
      if (mFilePath == NULL)
      {
          mIsLooping = false;
  
          sndFile = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, inFilePath, kCFURLPOSIXPathStyle, false);
          if (!sndFile) { printf("can't parse file path\n"); return; }
  
          NSLog(@"sndFile   %@", sndFile);
  
  
          XThrowIfError(AudioFileOpenURL (sndFile, kAudioFileReadPermission, 0/*inFileTypeHint*/, &amp;mAudioFile), "can't open file");
  
  
  
          UInt32 size = sizeof(mDataFormat);
  
          // printf("SIZE    %i\n ", size);
          XThrowIfError(AudioFileGetProperty(mAudioFile, 
                                         kAudioFilePropertyDataFormat, &amp;size, &amp;mDataFormat), "couldn't get file's data format");
          mFilePath = CFStringCreateCopy(kCFAllocatorDefault, inFilePath);
      }
      SetupNewQueue();        
  }
  catch (CAXException e) {
      char buf[256];
      fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
  }
  if (sndFile)
      CFRelease(sndFile);
   }
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT 3</strong></p>
  
  <pre><code>CFStringRef local_recordFilePath;   
  
  local_recordFilePath = (CFStringRef)[NSTemporaryDirectory() stringByAppendingPathComponent: @"LoopExtended.wav"];
  
  
  
  player-&gt;CreateQueueForFile(local_recordFilePath);
  </code></pre>