title: NMSFTP File Download Works on Simulator, not on iPhone
body: <p>I am trying to use the SFTP library in NMSSH to download files from an ftp server and have been having trouble on my actual device.  It works fine in the simulator.  When I check for the file's existence in the stored directory (a created folder in my app's cache directory), the check passes on the simulator but fails on the phone.  Below is the code I'm using.  As a note, <code>MainPath</code> is the directory path and the <code>fileListLevel1</code> row item is the file name with the extension.</p>
  
  <pre><code>        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
          NSString *cacheDirectory = paths[0];
          cacheDirectory = [@[cacheDirectory, @"/NewDirectory", @"/"] componentsJoinedByString:@""];
          [[NSFileManager defaultManager] createDirectoryAtPath:cacheDirectory withIntermediateDirectories:false attributes:nil error: nil];
          NSString *filePathToOpen = [@[MainPath, [fileListLevel1 objectAtIndex:indexPath.row]] componentsJoinedByString:@""];
          bool isFile = NO;
          bool isDir = NO;
          isFile = [session.sftp fileExistsAtPath:filePathToOpen];
          isDir = [session.sftp directoryExistsAtPath:filePathToOpen];
          if (isFile){
              NSString *fileToOpenNameAndPath = [@[cacheDirectory, [fileListLevel1 objectAtIndex:indexPath.row]] componentsJoinedByString:@""];
              [session.sftp writeFileAtPath:filePathToOpen toFileAtPath:fileToOpenNameAndPath];
                  //FILE NOT FOUND ON THE PHONE - FOUND IN SIMULATOR!!!!!!!!
              if ([[NSFileManager defaultManager] fileExistsAtPath:fileToOpenNameAndPath]){
                  NSLog(@"Found you!");
              }
              else if(![[NSFileManager defaultManager] fileExistsAtPath:fileToOpenNameAndPath]){
                  NSLog(@"Why you no there?");
              }
  </code></pre>
  
  <p>I also tried creating the paths using the <code>stringByAppendingPathComponent</code> method and got the same result.</p>
  
  <p>I'm new to app writing and objective c so I may be missing something fundamental here but I've been unable to find anything on this.  </p>
  
  <p>One additional question revolves around using the <code>writeFileAtPath:toFileAtPath:progress</code> command.  I wonder if my issue is with the simulator writing much faster so my check happens before it is done on the phone.  I'm not sure how to properly use the <code>:progress</code> portion as I'm unsure what type of variable the <code>(BOOL (^)(NSUInteger sent))</code> is referring to or how to create one to check the progress.</p>
  
  <p>Any help would be very much appreciated.</p>