Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
skantner
4 years agoHelpful | Level 5
dowloadUrl failing on iOS 16 with NSCocoaErrorDomain Code=513
My app has been using the Objective-C SDK without problem for many years. Currently I am running ObjectiveDropboxOfficial (6.3.2)
My app uses the API to allow the user to browse their Dropbox accou...
- 4 years ago
Problem is resolved. I pasted the sample code you mentioned into a test method, and it worked fine. I think it boiled down to a poorly formed URL that for some reason has worked for years prior to iOS 16. Thank you for pointing me in this direction!
Old code working before IOS 16:
NSString *tgtFile = @"Alive-E (SCORE).pdf";
NSString *sharedDocs="/Users/scott/Library/Developer/CoreSimulator/Devices/E2E5C99C-FC57-4078-AC3F-D5CCDA5668D1/data/Containers/Data/Application/ECFFFC6E-5F47-47CB-830A-B07CDCA07B71/Documents";
NSString *targetPath = [[NSString alloc] initWithFormat:@"%@",[sharedDocs stringByAppendingPathComponent:tgtFile]];
NSURL *targetURL = [NSURL URLWithString:[targetPath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]];
(lldb) p targetURL =
@"%2FUsers%2Fscott%2FLibrary%2FDeveloper%2FCoreSimulator%2FDevices%2FE2E5C99C-FC57-4078-AC3F-D5CCDA5668D1%2Fdata%2FContainers%2FData%2FApplication%2FECFFFC6E-5F47-47CB-830A-B07CDCA07B71%2FDocuments%2FAlive-E%20(SCORE).pdf"
New code, based on the code sample:
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *outputDirectory = [fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask][0];
NSURL *targetURL = [outputDirectory URLByAppendingPathComponent:tgtFile];
(lldb) p targetURL
@"file:///Users/scott/Library/Developer/CoreSimulator/Devices/E2E5C99C-FC57-4078-AC3F-D5CCDA5668D1/data/Containers/Data/Application/ECFFFC6E-5F47-47CB-830A-B07CDCA07B71/Documents/Alive-E%20(SCORE).pdf"
Greg-DB
Dropbox Community Moderator
4 years agoI just gave downloadUrl a try on iOS 16 beta on a simulator from Xcode 14 beta 3, using the code sample from here, and it didn't result in that error for me. Can you share a code snippet that reproduces this so we can investigate this? Thanks in advance!
skantner
4 years agoHelpful | Level 5
Problem is resolved. I pasted the sample code you mentioned into a test method, and it worked fine. I think it boiled down to a poorly formed URL that for some reason has worked for years prior to iOS 16. Thank you for pointing me in this direction!
Old code working before IOS 16:
NSString *tgtFile = @"Alive-E (SCORE).pdf";
NSString *sharedDocs="/Users/scott/Library/Developer/CoreSimulator/Devices/E2E5C99C-FC57-4078-AC3F-D5CCDA5668D1/data/Containers/Data/Application/ECFFFC6E-5F47-47CB-830A-B07CDCA07B71/Documents";
NSString *targetPath = [[NSString alloc] initWithFormat:@"%@",[sharedDocs stringByAppendingPathComponent:tgtFile]];
NSURL *targetURL = [NSURL URLWithString:[targetPath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]]];
(lldb) p targetURL =
@"%2FUsers%2Fscott%2FLibrary%2FDeveloper%2FCoreSimulator%2FDevices%2FE2E5C99C-FC57-4078-AC3F-D5CCDA5668D1%2Fdata%2FContainers%2FData%2FApplication%2FECFFFC6E-5F47-47CB-830A-B07CDCA07B71%2FDocuments%2FAlive-E%20(SCORE).pdf"
New code, based on the code sample:
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *outputDirectory = [fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask][0];
NSURL *targetURL = [outputDirectory URLByAppendingPathComponent:tgtFile];
(lldb) p targetURL
@"file:///Users/scott/Library/Developer/CoreSimulator/Devices/E2E5C99C-FC57-4078-AC3F-D5CCDA5668D1/data/Containers/Data/Application/ECFFFC6E-5F47-47CB-830A-B07CDCA07B71/Documents/Alive-E%20(SCORE).pdf"
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!