cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Download not able to find file when exists

Download not able to find file when exists

datan3rd
Explorer | Level 3
Go to solution

 

Building an app using xcode and objective c. I have been able to successfully get my backup sqlite file to upload but when attempting to use a download I am getting an error saying the file could not be opened because there is no such file. Am I missing something in the directory? I have tried all combinations including dropping the home/ and Apps/ and even the full web URL with no luck. The file exists when I access dropbox directly through the web.

DBUserClient *client = [DBClientsManager authorizedClient];
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSURL *outputDirectory = [fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask][0];
    NSURL *outputUrl = [outputDirectory URLByAppendingPathComponent:@"Backup.sqlite"];

    [[[client.filesRoutes downloadUrl:@"/home/Apps/Backup" overwrite:YES destination:outputUrl]
      setResponseBlock:^(DBFILESFileMetadata *result, DBFILESDownloadError *routeError, DBRequestError *networkError,
                         NSURL *destination) {
          if (result) {
              NSLog(@"%@\n", result);
              NSData *data = [[NSFileManager defaultManager] contentsAtPath:[destination path]];
              NSString *dataStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
              NSLog(@"%@\n", dataStr);
          } else {
              NSLog(@"%@\n%@\n", routeError, networkError);
          }
      }] setProgressBlock:^(int64_t bytesDownloaded, int64_t totalBytesDownloaded, int64_t totalBytesExpectedToDownload) {
          NSLog(@"%lld\n%lld\n%lld\n", bytesDownloaded, totalBytesDownloaded, totalBytesExpectedToDownload);
      }];

 

10 Replies 10

Greg-DB
Dropbox Staff
Go to solution

It should show up automatically when you're typing code. If you don't have it enabled, you can enable it under 'Preferences > Text Editing > Code completion'.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    datan3rd Explorer | Level 3
What do Dropbox user levels mean?