We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
JoelBarker
9 years agoExplorer | Level 3
Can't Download File From Dropbox downloadData With Objective-C
Hello,
I am trying to use the following code to download data from Dropbox using the Vs2 API:
NSString *filePath = @"/joelLockFolderV2_1489675832.409768.tsl";
[[client.filesRoutes downloadData:filePath] setResponseBlock:^(DBFILESFileMetadata *result, DBFILESDownloadError *routeError, DBRequestError *error, NSData *fileContents) { if (result) { NSLog(@"%@\n", result); NSString *dataStr = [[NSString alloc] initWithData:fileContents encoding:NSUTF8StringEncoding]; NSLog(@"%@\n", dataStr); } else { NSLog(@"%@\n%@\n", routeError, error); } }];
When I try this I receive the following error:
2017-03-16 15:58:35.759 xctest[78431:5712864] (null)
DropboxClientError[{
NSError = "Error Domain=NSURLErrorDomain Code=-1 \"unknown error\" UserInfo={NSErrorFailingURLKey=https://api-content.dropbox.com/2/files/download, NSLocalizedDescription=unknown error, NSErrorFailingURLStringKey=https://api-content.dropbox.com/2/files/download}";
}];
I have checked and the file at filePath exists. I've found that various Api calls correctly work. I am having the same problem with
[client.filesRoutes downloadUrl:filePath overwrite:TRUE destination:ril]
And:
[[client.filesRoutes uploadUrl:remoteFilePath inputUrl:localURL]
I've tried setting 'NSAppTransportSecurity' to Allow Arbitary loads.
Is there anything I am missing...?
Regards,
Joel
1 Reply
- Greg-DB9 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://github.com/dropbox/dropbox-sdk-obj-c/issues/109 ]
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!