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

Forum Discussion

westsider's avatar
westsider
Helpful | Level 5
7 years ago

SwiftyDropBox Auth Hangs

I'm following the SwiftyDropbox documentation for my project, and have gotten as far as having my app switch to authenticating via web login thru safari but it just hangs there.

 

If I build on an actual device and have the Dropbox app, I log in without a problem but I want the safari / web login to work as well.

 

I've named my app the same in Xcode and Dropbox.

I'm using Alamofire (4.5.1) SwiftyDropbox (4.6.0), Xcode 9.4.1 Swift 4. Deployment target 10.1

Keychain sharing is on.

 

I don't see anything in output to show me where I'm going wrong:

2018-08-17 10:45:08.792346-0500 Pic Droper[9957:299305] -canOpenURL: failed for URL: "dbapi-8-emm://1/connect" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2018-08-17 10:45:08.958285-0500 Pic Droper[9957:299305] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/15slim/Library/Developer/CoreSimulator/Devices/ABA24F85-62A1-4656-AE95-25BF8E735546/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-08-17 10:45:08.959279-0500 Pic Droper[9957:299305] [MC] Reading from private effective user settings.
2018-08-17 10:45:09.018774-0500 Pic Droper[9957:299305] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-08-17 10:45:23.442747-0500 Pic Droper[9957:299305] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction

 Podfile:

# Uncomment the next line to define a global platform for your project
  platform :ios, '10.1'

target 'Pic Droper' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Pic Droper
  pod 'SwiftyDropbox'

end

In my app delegate I have the following with my actual api key replaced:

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        DropboxClientsManager.setupWithAppKey("api-key-replaced")
        return true
    }

    // 2. Handle redirect back into SDK
    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
        if let authResult = DropboxClientsManager.handleRedirectURL(url) {
            switch authResult {
            case .success:
                print("Success! User is logged into Dropbox.")
            case .cancel:
                print("Authorization flow was manually canceled by user!")
            case .error(_, let description):
                print("\nError In app delegate: \(description)\n")
            }
        }
        return true
    }

In my view controller I'm calling my auth this way:

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(true)
        authDropbox()
    }
    
    // 1. Begin the authorization flow
    func authDropbox() {
        DropboxClientsManager.authorizeFromController(
            UIApplication.shared,
            controller: self,
            openURL: { (url: URL) -> Void in
                UIApplication.shared.open(url, options: [:], completionHandler: { (finished) in
                    if finished {print("finished")}
                })
        })
    }

Any ideas where I am going wrong?

Thanks so much - Wayne

  • I agree, the issue seems to have resolved itself for the time being. I am able to get a good login from both the browser and the DropBox app, from within my app...

     

    Using - 

    Alamofire (4.5.1) SwiftyDropbox (4.6.0), Xcode 9.4.1 Swift 4. Deployment target 10.1

    I was using the simulator and also and an actual device - iphoneX running 11.4.1

  • picnicbob's avatar
    picnicbob
    New member | Level 2

    We're getting the same problem in our production app that had been working until recently.

    The issue seems to be with webkit preventing cross-site-scripting between Dropbox and the Google reCAPTCHA system.

    Hopefully this is resolved soon as it is affecting users of our app.

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff
      Thanks for the reports! We'll look into it.
      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff
        I'm having some trouble reproducing this. Can you let me know:
        - Are you still seeing this issue?
        - What specific version(s) of iOS are you seeing it on?
        - Are you seeing this in the simulator, or only on the physical devices?

        Thanks in advance!

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!