We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

ShinehahGnolaum's avatar
ShinehahGnolaum
Helpful | Level 7
7 years ago

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:)

 

  • Greg-DB's avatar
    Greg-DB
    7 years ago

    The installation method isn't what I was referring to, but o clarify, there are three distinct methods for installing the library:

    1. CocoaPods
    2. Carthage
    3. Manually add subproject

    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.).

    • ShinehahGnolaum's avatar
      ShinehahGnolaum
      Helpful | 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-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        The installation method isn't what I was referring to, but o clarify, there are three distinct methods for installing the library:

        1. CocoaPods
        2. Carthage
        3. Manually add subproject

        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

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 5 hours ago
325 Following

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 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!