title: iPhone - copying a file from resources to Documents gives an error
body: <p>I am trying to copy an mp3 file from my Resources folder to a folder inside "Documents" folder of the app. On the simulator this works fine. But when I run it on a device, copying the files gives me this error</p>
  
  <pre><code>Operation could not be completed. (Cocoa error 513.)
  </code></pre>
  
  <p>The source and destinations paths are fine but I still cannot copy the file. Any ideas? Where can I find out what the cocoa error code 513 means?</p>
  
  <p>Thanks.</p>
  
  <p>Here's the relevant source code</p>
  
  <pre><code>    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];
  
      NSString *folderPath = [documentsDirectory stringByAppendingPathComponent:@"Files"];
  
      NSString *insPath = [NSString stringWithFormat:@"%@.mp3", fileName];
      NSString *srcPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:insPath];
      NSString *destPath = [folderPath stringByAppendingPathComponent:insPath];
      NSLog(@"Src: %@, Dest: %@", srcPath, destPath);
  
      NSError *err;
      [fileManager moveItemAtPath:srcPath toPath:destPath error:&amp;err];
  
      NSLog(@"Err desc-%@", [err localizedDescription]);
      NSLog(@"Err reason-%@", [err localizedFailureReason]);
  </code></pre>
  
  <p>Before making a call to moveItemAtPath, I am also creating the directory "Files" and it returns a YES.</p>
  
  <p>Here's the log results</p>
  
  <pre><code>Src: /var/mobile/Applications/512D7565-7EF7-4C13-A015-19EEC3F3B465/MyApp.app/MyFile.mp3, Dest: /var/mobile/Applications/512D7565-7EF7-4C13-A015-19EEC3F3B465/Documents/Files/MyFile.mp3
  
  Err desc-Operation could not be completed. (Cocoa error 513.)
  Err reason-(null)
  </code></pre>
  
  <p><strong>A question</strong></p>
  
  <p>Is there a limit to the file size when copying data from resources to Documents folder? The file I am trying to copy is about 5MB. Could that be a reason?</p>