I am new to SwiftyDropbox.
I attempted to upload PDF from iOS App.
func uploadPDF(filename: String, fullPath: String){
if let data = NSData(contentsOfFile: fullPath){
client.filesUpload(path: filename, body: data).response{ response, error in
if let metadata = response {
println("Uploaded file name: \(metadata.name)")
println("Uploaded file revision: \(metadata.rev)")
// Get file (or folder) metadata
self.client.filesGetMetadata(path: filename).response { response, error in
if let metadata = response {
println("Name: \(metadata.name)")
if let file = metadata as? Files.FileMetadata {
println("This is a file.")
println("File size: \(file.size)")
} else if let folder = metadata as? Files.FolderMetadata {
println("This is a folder.")
}
} else {
println(error!)
}
}
} else {
println(error!)
}
}
}
}
However, response is error.
Bad Input: Error in call to API function "files/upload": HTTP header "Dropbox-API-Arg": could not decode input as JSON
What can I do?