I had a simple implementation of DBChooser in my iPad app, and it worked fine up until the moment I upgraded my device and SDK to iOS 9.
What happens now is:
1) My app launches DBChooser (DBChooserLinkTypeDirect)
2) Dropbox appears
3) I pick my file
4) I get a 'Generating Link' message
5) I remain in the DropBox app instead of being returned to my app. openURL: is never called
I have set all of the URL schemes, and there are no syslog errors generated and, like I said, it used to work just fine.
I've tried all sorts of solutions, including creating brand new test apps that do nothing but fire up DBChooser. On one occasion, I created a completely new Xcode app, and a brand new DropBox app that used a new key, and the behavior changed slightly. This time, DropBox launched my app after I selected the file (openURL: was called in my app), and then DropBox was immediately launched over the top of my app again. This behavior happened 3 times in a row, and on the 4th (with no changes to the code or app setup), it went back to simply not exiting DropBox at all.
I've uninstalled DB and reinstalled it several times, written test apps, and gone over the docs with a fine tooth comb, but I simply can't get it behaving like it used to in iOS 8, which leads me to suspect the root cause is something to do with the new iOS 9 security stuff that went in. I've read reports from the iOS 9 beta that due to an iOS bug, openURL: had the extra security schemes that canOpenURL: now has, which might cause problems. openURL: should function as it used to in previous SDKs, according to Apple.
Can anybody shed some light on this? Has anybody else seen similar behavior?
Moved to the API forum.
Have you read through https://blogs.dropbox.com/developers/2015/08/important-update-your-core-api-app-for-ios-9/ and added dbapi-1 and dbapi-3 to your plist?
Can you share some sample code to reproduce the issue?
Thanks for your reply.
Yes, I've added the dbapi schemes to my plist, and here is the code I used for my super simple test (from a completely fresh Xcode new project):
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
if ([[DBChooser defaultChooser] handleOpenURL:url])
And then in ViewController.m:
[[DBChooser defaultChooser] openChooserForLinkType:DBChooserLinkTypeDirect fromViewController:self completion:^(NSArray *results)
if ([results count])
NSLog(@"Got file link.");
As you can see, there isn't much to it. The moment the app launches, it goes straight into DBChooser (which works), but the completion block in ViewController.m is never called, nor is openURL in AppDelegate.m, so control is never returned to my app from DBChooser.
This is on an iPad running 9.0.2. I am installing 9.1 now to see if that changes anything, but if not then I'm at a bit of a loss as to what's going on. I'd be really interested in someone else trying this test code just to see if I'm being bone-headed somewhere. I've created several apps from scratch in Xcode, and have followed the DropBox step-by-step setup over and over in an attempt to make sure I didn't miss anything. Like I said, it used to work on 8.x, and seemingly in 9.x the only change needed is to add the dbapi schemes, which I've done, hence the scratching of my head. 🙂
Any suggestions would be greatly appreciated.
PS. I had to retype the code into this post because copy and paste didn't work very well, so if there are any typos in the source, ignore them - the code compiles and runs fine.
Sorry, yes you're absolutely right, but for the purpose of this simple test, I had a breakpoint in viewDidAppear as well as in openURL, and also the completion block (probably should have mentioned that! :). I just wanted to ensure that control was returned to me.
DBChooser never returns to my app at all once you select a file (which is what used to happen).
Can you post the relevant snippets of your app's plist? I.e., the db-APP_KEY URL Type registration, as well as LSApplicationQueriesSchemes? I'm trying to reproduce this behavior.
Also, what version of the Dropbox for iOS app do you have installed?
I'm using the latest DBChooser from the DB website - v1.2.1 (11th Feb, 2014). I'm assuming that's the latest?
From my .plist file:
Naturally, MY_APP_KEY is replaced with my actual app key.
PS. I'm still waiting for the latest Xcode to install so I can test it on 9.1.
UPDATE: Functionality is back to normal on iOS9.1.
I didn't change a thing, other than updating to 9.1, and it works again. There must have been a bug in openURL in the v9.0.x SDK.
Apologies for the waste of time, but thanks for your help anyway. 🙂
The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.Sound good? Let's get started.
For more info on available support options, see this article.
If you found the answer to your question, please 'like' the post to say thanks to the user!