Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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 manuals with the right settings in info.plist and the SceneDelegate (see below).
Everything works fine as long as the Dropbox app is not installed on the device. As soon as the Dropbox app is on the device my app doesn't get a connection to the dropbox to exchange data. When launching my app it calls Dropbox to ask if I allow the access of my app. As soon as I confirm this, the return to my app doesn't work properly and the connection breaks. It seems that the DropboxClientsManager.authorizedClient is not properly set.
The error is reproducible - removing Dropbox app: all works, installing Dropbox app: problem is there.
Does anyone have an idea, what I can do to fix it? I would assume that I have to change some settings?
My current settings are:
info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>dbapi-8-emm</string>
<string>dbapi-2</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>db-**************</string>
</array>
</dict>
</array>
and in the sceneDelegate:
// MARK: - Dropbox
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if let url = URLContexts.first?.url {
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))")
}
}
}
DropboxClientsManager.handleRedirectURL(url, completion: oauthCompletion)
}
}
Thanks for your support
Regards gcarl
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.
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!