title: iOS9 NSFileManager asks for permission to save files in Documents directory
body: <p>For the long time I receive a strange error, but only when running on a device. In simulator everything is just fine. What I do is moving sample files from app bundle directory to Documents directory on a device.
  I have tried all those methods for NSFileManager:</p>
  
  <pre><code>- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error
  - (BOOL)moveItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error
  - (BOOL)linkItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error
  </code></pre>
  
  <p>And every one throws errors like following:</p>
  
  <blockquote>
    <p>2015-08-15 23:14:15.152 app[1010:339938] Error: Error Domain=NSCocoaErrorDomain Code=513 "“file.txt” couldn’t be linked because you don’t have permission to access “Documents”." UserInfo={NSSourceFilePathErrorKey=/var/mobile/Containers/Bundle/Application/verylongid/fastdict.app/Dictionaries/file.txt, NSUserStringVariant=(
        Link
    ), NSDestinationFilePath=/var/mobile/Containers/Data/Application/verylongid/Documents/file.txt, NSFilePath=/var/mobile/Containers/Bundle/Application/verylongid/fastdict.app/Dictionaries/file.txt, NSUnderlyingError=0x13666d5a0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} in -[AppDelegate fillDirectoryWithSamplesIfEmpty]</p>
  </blockquote>
  
  <p>How can I solve this problem?</p>
  
  <p>Update: The <a href="https://stackoverflow.com/a/1564028/2766161">solution</a> found here really works!
  Good luck!</p>