title: iOS copy files from main bundle to documents directory
body: <p>I am trying to copy files that I add to a folder called "includes" to a folder on documents directory called also "includes".</p>
  
  <p>I get a nil value for <code>resContents</code>. Why?</p>
  
  <pre><code>- (void)copyResources{
  
      NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"includes"];
      NSString *destPath = [[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"includes"];
  
      NSArray* resContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:sourcePath error:NULL];
  
      for (NSString* obj in resContents){
          NSError* error;
          if (![[NSFileManager defaultManager] copyItemAtPath:[sourcePath stringByAppendingPathComponent:obj] toPath:[destPath stringByAppendingPathComponent:obj] error:&amp;error]) {
              NSLog(@"Error: %@", error);;
          }
      }
  }
  </code></pre>