cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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: 

After updating to iOS 9, App gets stuck when trying to login into dropbox

After updating to iOS 9, App gets stuck when trying to login into dropbox

alvaro a.2
New member | Level 1

Hi,

My App stopped working after updating to iOS 9 because of the new Apple restriction on canopenurl which forces to register the url schemes you plan to you use in your app. 

I followed this tutorial to register the url schemes for my App: https://blogs.dropbox.com/developers/2015/08/important-update-your-core-api-app-for-ios-9/

However, I am still getting the error  dbapi-2://1/connect" - error: "(null)" when I I run the app in the simulator and try to connect to dropbox.I supposed that is because I don't have the dropbox app in the simulator.

When I run my app in the device I don't get the error because I have dropbox  installed. The problem thought is the App will open dropbox to log the user but then after login, it won't come back to my app and if I come back manually, it won't upload files because it tells me the user is unauthorized.

I read in this post on stackoverflow http://stackoverflow.com/questions/31454686/in-ios9-dropbox-app-is-not-being-opened-instead-webview-... that because of the new restriction, dropbox will have to register url schemes for all apps that support its sdk?

Any advice on how to solve this problem?

 

7 Replies 7

Re: After updating to iOS 9, App gets stuck when trying to login into dropbox

Greg-DB
Dropboxer

The null error in the simulator is expected, since the Dropbox app isn't installed, but it should fall back to the built-in authorization flow.

The restriction in iOS 9 only applies to canOpenURL, and not openURL, so the official Dropbox app itself does not need to register the URL schemes of every app that uses the SDK. (There was a bug in a beta version of iOS 9 that affected this though, so make sure you're running a general release version.)

If you're seeing an issue with the user not getting redirected back to your app after authorizing it in the Dropbox app, please make sure you've followed all of the instructions from the installation and tutorial pages. If you're still seeing this issue, please follow up here with:

  • the steps to reproduce the issue, including the versions of iOS and the Dropbox iOS SDK you're using
  • the relevant code snippet(s), e.g., where you initialize your DBSession and call linkFromController, if you're using the Core SDK, or the equivalent in SwiftyDropbox
  • the relevant pieces of your app's plist, e.g., where you register LSApplicationQueriesSchemes, as well as your own db-APP_KEY scheme

Re: After updating to iOS 9, App gets stuck when trying to login into dropbox

Steve M.
Dropboxer

Cross-linking with http://stackoverflow.com/questions/33765981/ios9-unable-to-complete-login-process-when-using-dropbox... on Stack Overflow, which may be the same question.

Re: After updating to iOS 9, App gets stuck when trying to login into dropbox

alvaro a.2
New member | Level 1

Steve, yes I posted the question on stackoverflow as well since I thought I was going to have better luck but since you guys replied to the post. I am deleting the question from stackoverflow.

Gregory, thanks for replying. My iOS version is 9 and I am using Swiftydropox tutorial and not the tutorial you mentioned which appears to for objective C. The dropbox SDK version I am using, I supposed is for Swift 2, I followed this steps  to install it.

Here are the functions included in my delegate:

  func application(application: UaIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {   
        
            Dropbox.setupWithAppKey("myappkey")
    
            // Override point for customization after application launch.
            return true
        }



    func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {      
            if let authResult = Dropbox.handleRedirectURL(url) {
                switch authResult {
                case .Success(let token):
                    print("Success! User is logged into Dropbox.")
                case .Error(let error, let description):
                    print("Error: \(description)")
                }
            }
            
            return false
        }

I noticed the function that handles Authorization never gets call.

And here is the declaration on my info.Plist

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>dbapi-2</string>
    </array>

Let me know if you need any other information, thanks.

 

 

 

 

 

Re: After updating to iOS 9, App gets stuck when trying to login into dropbox

Greg-DB
Dropboxer

Thanks! We'd need to see the actual setupWithAppKey call with your key, as well as where you set up your db-APP_KEY scheme in your plist for this though. If you'd rather not share those publicly, you can open an API ticket here:

https://www.dropbox.com/developers/contact

Re: After updating to iOS 9, App gets stuck when trying to login into dropbox

alvaro a.2
New member | Level 1

Sure, I can provide that information. Here is db-APP_KEY on my info.Plist file

<array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>bd31o3eded5n334</string>
            </array>
        </dict>
    </array>

And here is the function with the actual setupWithAppKey


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        
        Dropbox.setupWithAppKey("bd31o3eded5n334")

        // Override point for customization after application launch.
        return true
    }

Let me know if you need to see something else.

Re: After updating to iOS 9, App gets stuck when trying to login into dropbox

Greg-DB
Dropboxer

Per the tutorial, the URL scheme you register in CFBundleURLSchemes should be "db-APP_KEY", where "APP_KEY" is your app key. You have just "APP_KEY" registered. This is how the Dropbox app redirects the user back to your app, so just add "db-" to the beginning of that and that should fix it.

Re: After updating to iOS 9, App gets stuck when trying to login into dropbox

alvaro a.2
New member | Level 1

Yes! that did it. I just needed to add "db-" to make it work. Good  catch, I guess I couldn't have done it on my own, I never suspected there was something wrong with my APP-KEY.

Thanks Gregory!

 

Who's talking

Top contributors to this post

  • User avatar
    alvaro a.2 New member | Level 1
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?