title: Not receiving data from AWS S3 Transfer Manger Download Request iOS SDK v2.0.5
body: <p>I have all of the authentication issues worked out and I know that the credentials provided give access to all of my S3 buckets. When I run the code below, it runs without task.error, but the [task.result body] returns 0 bytes of data. </p>
  
  <pre><code>    AWSS3 *s3 = [[[AWSS3 alloc] initWithConfiguration:configuration] autorelease];
      transferManager = [[[AWSS3TransferManager alloc] initWithS3:s3] autorelease];
      getFileRequest = [[AWSS3TransferManagerDownloadRequest new] autorelease];        
      getFileRequest = [[AWSS3TransferManagerDownloadRequest new] autorelease];
      getFileRequest.bucket = @"MY_BUCKET";
      getFileRequest.key = @"MY_KEY";
          [[transferManager download:getFileRequest] continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:^id(BFTask *task){
              if (task.error != nil) {
                  NSLog(@"Error: [%@]", task.error);
              }
              else {
                  NSArray       *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
                  NSString  *documentsDirectory = [paths objectAtIndex:0];
                  NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"Data.dat"];
                  NSData *data = [task.result body];
                  NSString *download = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
                  NSError *error;
                  [download writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error: &amp;error];
              }
              return nil;
          }];
  </code></pre>
  
  <p>The only error that is posted to the log is </p>
  
  <blockquote>
    <p>AWSiOSSDKv2 [Error] AZURLSessionManager.m line:467 |
    -[AZURLSessionManager URLSession:dataTask:didReceiveResponse:completionHandler:] | Error:
    [Error Domain=NSCocoaErrorDomain Code=21 "The operation couldn’t be
    completed. (Cocoa error 21.)" UserInfo=0xc67f840
    {NSFilePath=/Users/firstname_lastname/Library/Application Support/iPhone
    Simulator/7.1/Applications/number/tmp}]</p>
  </blockquote>
  
  <p>Has anyone had a similar issue or see something in the code that was left out or is incorrect? If you need any other info feel free to ask</p>
  
  <p>Answer:
  I figured out the issue. As mentioned in the comments below, "DirectWrite" was turned on, so instead of putting the data into the task.result object, it looks for a file path under the "downloadingFileURL" property of the AWSS3TransferManagerDownloadRequest object. Below is the corrected code:</p>
  
  <pre><code>NSArray       *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString  *documentsDirectory = [paths objectAtIndex:0];
  NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"predata"];    
  getFileRequest.downloadingFileURL = [NSURL fileURLWithPath:path];
  [[_transferManager download:getFileRequest] continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:^id(BFTask *task){
      if (task.error != nil) {
          NSLog(@"Error: [%@]", task.error);
      }
      else {
          NSError *error;
          [[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:filePath] error:&amp;error];
          NSData *data = [NSData dataWithContentsOfURL:path];
          NSString *download = [[NSString alloc] initWithData:data encoding:NSMacOSRomanStringEncoding];
          [download writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error: &amp;error];
      }
      return nil;
  }];
  </code></pre>
  
  <p>Hope this can help someone else and thanks for the help @LyndseyScott and @YosukeMatsuda</p>