You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Bill P.3
9 years agoExplorer | Level 4
-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.
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-DBDropbox 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.3Explorer | 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-DBDropbox 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
Find help with the Dropbox API from other developers.
5,883 PostsLatest Activity: 2 days agoIf 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!