im trying to download a file but am getting a 404 error, "not found". Im thinking that the file-id is not supposed to be the file name of the file I'm trying to download from my BOX account. heres my code:
let contentClient = BOXContentClient.default()
let localFilePath: String = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("savedClients.data").absoluteString
let boxRequest: BOXFileDownloadRequest? = contentClient?.fileDownloadRequest(withID: "savedClients.data", toLocalFilePath: localFilePath)
boxRequest?.perform(progress: {(_ totalBytesTransferred: Int64, _ totalBytesExpectedToTransfer: Int64) -> Void in
// Update a progress bar, etc.
}, completion: {(_ error: Error?) -> Void in
// Download has completed. If it failed, error will contain reason (e.g. network connection)
if error == nil {
print("------------ \nCardSelection VC: Downloaded savedClients.data file")
if let savedClientsData = FileManager.default.contents(atPath: localFilePath) {
if let model = NSKeyedUnarchiver.unarchiveObject(with: savedClientsData) as? ClientModel] {
self.savedClients = model
self.reloadData()
UIApplication.shared.isNetworkActivityIndicatorVisible = false
}
}
} else {
print("-------------\nCardSelection VC: BOX error downloading savedClients file: \(String(describing: error))")
UIApplication.shared.isNetworkActivityIndicatorVisible = false
let alert = UIAlertController(title: "Error", message: "There was an error downloading saved clients file from BOX:\(String(describing: error))", preferredStyle: .alert)
let dismiss = UIAlertAction(title: "Dismiss", style: .default, handler: nil)
alert.addAction(dismiss)
self.present(alert, animated: true, completion: nil)
}
})