You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
ShinehahGnolaum
7 years agoHelpful | Level 7
I can't get a logged in instance of DropboxClient
In another post about the 10814 error it said I could ignore the error, but in this case it looks like I'm not getting the instance of DropboxClient even after I log in.
I get the following messages in my debug window:
Spoiler
DropboxViewController.viewWillAppear(_:)
2018-08-06 20:23:28.434567-0500 Gnolaum[35840:1973880] -canOpenURL: failed for URL: "dbapi-2://1/connect" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2018-08-06 20:23:28.437971-0500 Gnolaum[35840:1973880] -canOpenURL: failed for URL: "dbapi-8-emm://1/connect" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
When I run the following code:
override func viewWillAppear(_ animated: Bool) { print("DropboxViewController.viewWillAppear(_:)") if let client = DropboxClientsManager.authorizedClient { // List contents of app folder _ = client.files.listFolder(path: "").response { response, error in if let result = response { print("Folder contents:") for entry in result.entries { print(entry.name) self.filenames?.append(entry.name) } } } } else { // Present view to log in DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: self, openURL: {(url: URL) -> Void in UIApplication.shared.openURL(url)}) } }
This is code I copied from the PhotoWatch sample. It works there. I also don't get the error 10814 in PhotoWatch. Why will my code not work?
In another part of my code, I do notice that I am able to get an instance of DrobpoxClient using
DropboxClient(accessToken:)
The installation method isn't what I was referring to, but o clarify, there are three distinct methods for installing the library:
You can and should only use one of them. Each one is sufficient for installing the library. Within each method, all of the steps are required, unless stated otherwise.
In any case, the exact installation method that you use isn't relevant to your original authorizedClient question here. As long as the installation was successful, each of them result in a library that you use the same way.
After installation, however, there are more, not optional, steps you need to follow to make sure you can process the app authorization flow properly. Can you confirm you followed all of the instructions under "Configure your project" in particular?
If so, you should be able to go through the app authorization flow in your app like an end-user would, and then when you get back you can get a client from authorizedClient.
If that's not working properly, please share the rest of the relevant code (e.g., the code in your app delegate, per the intstructions, etc.).
In the process of checking my steps, I tried adding the succeeding step
https://github.com/dropbox/SwiftyDropbox#handle-redirect-back-into-sdk
and it worked.
Thank you for your help.
- Greg-DBDropbox StaffCan you confirm that you followed all of the instructions under "Configure your project" and "Handling the authorization flow"?
https://github.com/dropbox/SwiftyDropbox#configure-your-project
Those instructions cover the necessary steps for implementing the app authorization flow, so that you can retrieve a client using authorizedClient.- ShinehahGnolaumHelpful | Level 7
I followed the instructions exactly. When I ran into problems, I was able to get help by posting in GitHub and on this forum and was able to correct the errors. I chose to use Carthage and chose not to do the manual step at this link:
https://github.com/dropbox/SwiftyDropbox#manually-add-subproject
Am I correct to assume that step was only to be taken if I had not taken the previous step? I take it I would not need to add the SwiftyDropbox and Alamofire Xcode projects manually into my Xcode projects if I already added the frameworks into my projects.
- Greg-DBDropbox Staff
The installation method isn't what I was referring to, but o clarify, there are three distinct methods for installing the library:
You can and should only use one of them. Each one is sufficient for installing the library. Within each method, all of the steps are required, unless stated otherwise.
In any case, the exact installation method that you use isn't relevant to your original authorizedClient question here. As long as the installation was successful, each of them result in a library that you use the same way.
After installation, however, there are more, not optional, steps you need to follow to make sure you can process the app authorization flow properly. Can you confirm you followed all of the instructions under "Configure your project" in particular?
If so, you should be able to go through the app authorization flow in your app like an end-user would, and then when you get back you can get a client from authorizedClient.
If that's not working properly, please share the rest of the relevant code (e.g., the code in your app delegate, per the intstructions, etc.).
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,884 PostsLatest Activity: 2 hours agoIf 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 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!