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

Forum Discussion

Anthony B.15's avatar
Anthony B.15
Explorer | Level 4
7 years ago

Xcode 9 simulator DropboxClientsManager.authorizeFromController failing.

Using SwiftyDropbox 4.3.0 on iOS.

I'm trying to link my app to my Dropbox account on the latest iOS simulator and it is failing with the following errors:

-canOpenURL: failed for URL: "dbapi-2://1/connect" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

-canOpenURL: failed for URL: "dbapi-8-emm://1/connect" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

 

Error -10814 (kLSApplicationNotFoundErr) says "No application in the Launch Services database matches the input criteria.". I don't have the Dropbox app installed in the simulator, so shouldn't it just be launching Safari?

 

This was previously working fine in Xcode 9.1. Things seem to still be running fine on a real device. Anyone have an idea what might be going on?

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

    We've seen this happen when the controller passed in to authorizeFromController isn't the top-most controller. The solution would be to make sure that you're passing the top-most view controller when authorizing. For example, with the UISplitViewController case, it's not necessarily self. Can you check if that's what's happening in your case?

  • Anthony B.15's avatar
    Anthony B.15
    Explorer | Level 4

    Just a follow-up. This only seems to be happening with the iPad simulator in Xcode 9.2. I've not seen it occur when using one of the iPhone simulators. Seems kind of like an Xcode simulator bug but I can't say for sure.

    Would appreciate if anyone else could confirm this.

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff
      That's correct, these 10814 errors are expected when the official Dropbox iOS app isn't installed, and the SDK should automatically fall back to processing the app authorization flow in Safari in that case. (More specifically, it should present a SFSafariViewController with the OAuth 2 app authorization flow on the Dropbox web site.)

      I just tried this in an iPad simulator with Xcode 9.2 though, and it worked for me. Can you elaborate on what does/doesn't happen for you? Does the SFSafariViewController not get presented at all? Does it happen in multiple iPad simulators? If not, you may want to try resetting that particular simulator in case it's somehow in a broken state.
      • Anthony B.15's avatar
        Anthony B.15
        Explorer | Level 4

        The SFSafariViewController does appear but it just seems to hang. It doesn't load the login page and doesn't even show any browser controls.

        I've done a little more testing and now find that this only occurs in portrait mode of all the iPad simulators. In landscape mode it works ok. About the only difference here is that I am using a UISplitViewController, but my "link" button is always in the same view controller. In either case, I initiate the authorization sequence as follows:

         

            DropboxClientsManager.authorizeFromController(UIApplication.shared,

                                                          controller: self,

                                                          openURL: { (url: URL) -> Void in UIApplication.shared.openURL(url)

            })

         

        This behavior is strange considering that all this worked correctly before Xcode 9.

        Thanks for the help. I'll keep experimenting.

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: 12 months 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!