Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Bill P.3
10 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.
4 Replies
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
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.310 years agoExplorer | 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-DB10 years ago
Dropbox Community Moderator
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.310 years agoExplorer | Level 4
That was the problem. Thanks!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!