cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Re: -999 "cancelled" Error

-999 "cancelled" Error

Bill P.3
Explorer | Level 4
Go to solution

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.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

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
Explorer | Level 4
Go to solution

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
Dropbox Staff
Go to solution

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.

Bill P.3
Explorer | Level 4
Go to solution

That was the problem.  Thanks!

Need more support?