Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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 account and download PDF files.
Now on the iOS 16 beta (beta 3 is the first I've tried), I am getting permission errors like what was reported years ago here, e.g. https://github.com/dropbox/dropbox-sdk-obj-c/issues/125. I have tried setting forceForegroundSession:YES, but it does not fix the issue. The issue occurs both on the simulator and on a physical device (iPad)
I have included the error message below for completeness. I would greatly appreciate help with this. My app is essentially useless without working Dropbox capability.
Thanks!
DropboxClientError[{
NSError = "Error Domain=NSCocoaErrorDomain Code=513 \"\U201c258D96CC-96B9-4747-A85D-26DE78A98B9E\U201d couldn\U2019t be moved because you don\U2019t have permission to access \U201cSystem\U201d.\"
UserInfo={NSDestinationFilePath=/%2Fvar%2Fmobile%2FContainers%2FData%2FApplication%2F06070902-D1B0-47D2-80C9-20B6AE5112D7%2FDocuments%2FBetter Word-Eb (LEAD).pdf, NSUserStringVariant=Move,
NSFilePath=/private/var/mobile/Containers/Data/Application/06070902-D1B0-47D2-80C9-20B6AE5112D7/tmp/258D96CC-96B9-4747-A85D-26DE78A98B9E, NSUnderlyingError=0x282dfb2a0 {Error Domain=NSCocoaErrorDomain Code=513 \"\U201c258D96CC-96B9-4747-A85D-26DE78A98B9E\U201d couldn\U2019t be copied because you don\U2019t have permission to access \U201cSystem\U201d.\" UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Containers/Data/Application/06070902-D1B0-47D2-80C9-20B6AE5112D7/tmp/258D96CC-96B9-4747-A85D-26DE78A98B9E, NSUserStringVariant=(\n Copy\n), NSDestinationFilePath=/%2Fvar%2Fmobile%2FContainers%2FData%2FApplication%2F06070902-D1B0-47D2-80C9-20B6AE5112D7%2FDocuments%2FBetter Word-Eb (LEAD).pdf, NSFilePath=/private/var/mobile/Containers/Data/Application/06070902-D1B0-47D2-80C9-20B6AE5112D7/tmp/258D96CC-96B9-4747-A85D-26DE78A98B9E, NSUnderlyingError=0x282dfae50 {Error Domain=NSPOSIXErrorDomain Code=1 \"Operation not permitted\"}}}}";
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"
I 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!
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"
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!