cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in learning how media industry leaders use Dropbox Replay? Register for our webinar here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Xcode 9 simulator DropboxClientsManager.authorizeFromController failing.

Xcode 9 simulator DropboxClientsManager.authorizeFromController failing.

Anthony B.15
Explorer | Level 4
Go to solution

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?

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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?

View solution in original post

6 Replies 6

Anthony B.15
Explorer | Level 4
Go to solution

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
Dropbox Staff
Go to solution
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
Explorer | Level 4
Go to solution

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.

Greg-DB
Dropbox Staff
Go to solution

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
Explorer | Level 4
Go to solution

Hi Greg. Yes it seems you nailed it.

In my case the solution is to pass the secondary (detail) VC when the UISplitViewController.displayMode is PrimaryOverlay (portrait). By passing 'self' I am passing the top-most VC in the primary view controller (a UINavigationController). Evidently this is ok when the displayMode is AllVisible (landscape).

I like UISplitViewController, but it can create some interesting challenges.

Thanks for your help!

Lou P.6
Helpful | Level 6
Go to solution

Hi,  Just in case you have the more odd version of this issue, where the pop up message just hangs, which took me about 2 weeks to uncover; I neglected to add to my AppDelegate.m, the "openURL" code; (below). 

Apparently the simulators would call this and hang.  On a real iPhone or iPad, a little pop up window would show up, then things would be fine.  But on the simulators after OS 10.13.6, would stop me from connecting.  The code below caused it to complete and connect. 

I can't thank this forum and stackoverflow for all the help over the years.  what a great group of people...thanks so much.

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url

            options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {

    DBOAuthResult *authResult = [DBClientsManager handleRedirectURL:url];

    if (authResult != nil) {

        if ([authResult isSuccess]) {

            NSLog(@"Success! User is logged into Dropbox.");

        } else if ([authResult isCancel]) {

            NSLog(@"Authorization flow was manually canceled by user!");

        } else if ([authResult isError]) {

            NSLog(@"Error: %@", authResult);

        }

    }

    return NO;

}

Need more support?