Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
gcarl
5 years agoExplorer | Level 4
iOS - Problems connecting from own app to Dropbox when Dropbox App is installed
Dear community,
since a few days I have the following strange situation.
I have developed an app for iOS which can store data on the Dropbox. The connection is set up as described in the ...
gcarl
5 years agoExplorer | Level 4
Dear greg-db,
thanks for your support. Unfortunately, I can't manage it.
I'm using the DropboxApp version 258.2.2.
SwiftyDropbox SDK-version is 7.0.1
For the authorization I use the "authorizeFromControllerV2" as described:
func connectDropbox(withRequest request: Dropboxrequest) {
let scopeRequest = ScopeRequest(scopeType: .user, scopes: ["files.content.write"], includeGrantedScopes: false)
DropboxClientsManager.authorizeFromControllerV2(
UIApplication.shared,
controller: self,
loadingStatusDelegate: nil,
openURL: { (url: URL) -> Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) },
scopeRequest: scopeRequest
)
}
and the functions within AppDelegate and in SceneDelegate are as described in the manual:
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
let oauthCompletion: DropboxOAuthCompletion = {
if let authResult = $0 {
switch authResult {
case .success:
print("Success! User is logged into DropboxClientsManager.")
case .cancel:
print("Authorization flow was manually canceled by user!")
case .error(_, let description):
print("Error: \(String(describing: description))")
}
}
}
for context in URLContexts {
// stop iterating after the first handle-able url
if DropboxClientsManager.handleRedirectURL(context.url, completion: oauthCompletion) { break }
}
}
When trying to read or write a file to Dropbox I'm always referred to the Authorization Screen from the Dropbox and I'm asked if I want to give access permission for my app.
Furthermore I got the following messages:
021-11-05 17:16:15.392198+0000 Kochbuch[36069:5578791] [connection] nw_read_request_report [C4] Receive failed with error "Software caused connection abort"
2021-11-05 17:16:15.411732+0000 Kochbuch[36069:5578791] Task <F851E3DF-4C19-444C-AB1B-82ACB996ACD8>.<4> HTTP load failed, 36/0 bytes (error code: -1005 [1:53])
2021-11-05 17:16:15.412911+0000 Kochbuch[36069:5579146] Task <F851E3DF-4C19-444C-AB1B-82ACB996ACD8>.<4> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "Die Netzwerkverbindung wurde unterbrochen." UserInfo={_kCFStreamErrorCodeKey=53, NSUnderlyingError=0x2806e0840 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F851E3DF-4C19-444C-AB1B-82ACB996ACD8>.<4>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <F851E3DF-4C19-444C-AB1B-82ACB996ACD8>.<4>"
), NSLocalizedDescription=Die Netzwerkverbindung wurde unterbrochen., NSErrorFailingURLStringKey=https://api.dropbox.com/oauth2/token, NSErrorFailingURLKey=https://api.dropbox.com/oauth2/token, _kCFStreamErrorDomainKey=1}
Error: nil
Greg-DB
Dropbox Community Moderator
5 years agoThanks for following up and sharing that error output. That particular error code indicates that the network connection was lost. (The https://api.dropbox.com/oauth2/token address is used by the last step of the authorization flow, to call the Dropbox severs to retrieve the access token.)
Is there anything on your network connection/device that may be interfering with the connection to api.dropbox.com, such as firewall, proxy, VPN, anti-virus, etc.?
- gcarl5 years agoExplorer | Level 4
Dear greg-db,
thanks for your immediate reply. I'm really fascinated how quick you always answer and appreciate it very much. Thanks for this too.
To your question: no I don't have any additional firewalls, -settings etc in my network or on my phone which could interfere. And the problem occurs independent if I use my iPhone in my WLAN or only with mobile data. Furthermore, the Dropbox-App itself has no problems to connect and to browse - and the same applies, if I use my app without the Dropbox-App installed. In this case I have a stable connection to my Dropbox account and can browse, read and write files without any problems.
- Greg-DB5 years ago
Dropbox Community Moderator
gcarl Thanks for confirming that. Unfortunately it's not clear why that would be failing, but this issue looks similar to this report. Are you able to reproduce the same properties they mentioned though, such as differences across devices, and being able to work around the issue by waiting?
- gcarl5 years agoExplorer | Level 4
Dear GrebDB,
I did various tests on several devices with the same effect.
But finality I think, I found a solution.
Although specified in the app declaration on Dropbox, that the app needs scopes "files.content.write" and "files.content.read" too, it didn't work
Hence I changed the scope request when initially calling the Dropbox to get access and included all scopes:
"
let scopeRequest = ScopeRequest(scopeType: .user, scopes: ["files.content.write", "files.content.read", "account_info.read"], includeGrantedScopes: false)
DropboxClientsManager.authorizeFromControllerV2(
UIApplication.shared,
controller: self,
loadingStatusDelegate: nil,
openURL: { (url: URL) -> Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) },
scopeRequest: scopeRequest
)
"
By doing so, it seems that the problem is fixed.
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!