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

Forum Discussion

Bill P.3's avatar
Bill P.3
Explorer | Level 4
9 years ago

-999 "cancelled" Error

API: SwiftyDropbox version 4.1.0. 

 

Whenever the client.files.listFolder endpoint is execute the following error message is received:

 

Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://api.dropbox.com/2/files/list_folder, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://api.dropbox.com/2/files/list_folder}

 

 I am able to authenticate but cannot successfully execute any endpoints.  Any idea what generates this error?   Thanks.

  • Greg-DB's avatar
    Greg-DB
    9 years ago

    Thanks, that's helpful! It looks like the issue here is that you're building the client inside the IBAction, and it's going out scope before the API call can finish. Trying defining your client outside the IBAction so that it doesn't get lost.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    A -999 error is NSURLErrorCancelled, which is documented as:

     

    Returned when an asynchronous load is canceled.

     

    Can you check if your app is accidentally calling .cancel() on the request by any chance?

     

    Otherwise, I can't seem to reproduce this, so can you let us know:

    • the code snippet you're using to reproduce this
    • the version(s) of iOS you're seeing this with
    • the version(s) of Xcode you're seeing this with

    Thanks in advance! 

     

    • Bill P.3's avatar
      Bill P.3
      Explorer | Level 4

      Thanks for the quick response!

       

      Code Snippet:

      import UIKit

      import SwiftyDropbox

       

      class ViewController: UIViewController {

       

         let accessToken = “not shown but is valid"

              

         override func viewDidLoad() {

              super.viewDidLoad()

          }

         

          @IBAction func button1Pressed(_ sender: UIButton) {

              let client = DropboxClient(accessToken: accessToken)

              client.files.listFolder(path: "").response { response, error in

                  DispatchQueue.main.async() { guard error == nil else { return }  }

              }

          }

      }

       

      iOS Version: 10.0

       

      Xcode Version: 8.0

       

      Additional information: This endpoint was initially working in another project but then stopped working returning the same error message.  Now, whenever a new project is created the error message is returned on all endpoints.  Any suggestions on areas I can investigate?  

       

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Thanks, that's helpful! It looks like the issue here is that you're building the client inside the IBAction, and it's going out scope before the API call can finish. Trying defining your client outside the IBAction so that it doesn't get lost.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,876 PostsLatest Activity: 3 hours 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!