             controller.presentViewController(alertController, animated: true, completion: { fatalError(message) } )
             return
         }
-        if UIApplication.sharedApplication().canOpenURL(dAuthURL(nil)) {
+        if let scheme = dAuthScheme() {
             let nonce = NSUUID().UUIDString
             NSUserDefaults.standardUserDefaults().setObject(nonce, forKey: kDBLinkNonce)
             NSUserDefaults.standardUserDefaults().synchronize()
             
-            UIApplication.sharedApplication().openURL(dAuthURL(nonce))
+            UIApplication.sharedApplication().openURL(dAuthURL(scheme, nonce: nonce))
         } else {
             let web = DropboxConnectController(
                 URL: self.authURL(),

            return
        }
        if !self.hasApplicationQueriesScheme() {
            let message = "DropboxSDK: unable to link; app isn't registered to query for URL scheme dbapi-2. Add a dbapi-2 entry to LSApplicationQueriesSchemes"
            
            let alertController = UIAlertController(
                title: "SwiftyDropbox Error",

        ]
        return components.URL!
    }

    private func dAuthScheme() -> String? {
        if canOpenDAuthScheme("dbapi-2") {
            return "dbapi-2"
        } else if canOpenDAuthScheme("dbapi-8-emm") {
            return "dbapi-8-emm"
        } else {
            return nil
        }
    }

    private func canOpenDAuthScheme(scheme: String) -> Bool {
        return UIApplication.sharedApplication().canOpenURL(dAuthURL(scheme, nonce: nil))
    }

    private func dAuthURL(scheme: String, nonce: String?) -> NSURL {
        let components = NSURLComponents()
        components.scheme =  scheme
        components.host = "1"
        components.path = "/connect"
        
