Comment télécharger un fichier PDF dans IOS en utilisant Swift 3.0 et Alamofire. Je peux récupérer l'URL avec nsurlsession. Mais je suis à la recherche de code alamofire. s'il vous plaît voir mon code.Comment télécharger le fichier pdf de json dans swift et alamofire dans ios?
func downloadPdffile(_ sender : UIButton) {
print(sender.tag)
print("ARRAY VALUES FROM CELL",totalSyllabusArray.object(at: sender.tag))
var localDic :NSDictionary!
localDic = totalSyllabusArray.object(at: sender.tag) as! NSDictionary
let filepath = localDic["filepath"] as! String
print("pressed ")
let strURL1:String = FETCH_InMegh_Image_BaseURL + filepath
print("strURL1 is ",strURL1)
let pathURL = URL(string: strURL1)!
let sessionConfig = URLSessionConfiguration.default
let session = URLSession(configuration: sessionConfig)
let request = try! URLRequest(url: pathURL, method: .get)
let task = session.downloadTask(with: request) { (tempLocalUrl, response, error) in
if let tempLocalUrl = tempLocalUrl, error == nil {
// Success
if let statusCode = (response as? HTTPURLResponse)?.statusCode {
print("Success: \(statusCode)")
print("tempLocalUrl: \(tempLocalUrl)")
} else {
print("Failure: %@", error?.localizedDescription);
}
}
}
}
}
Comment poser une question. Vous pouvez effectuer une recherche pour vous-même. Mais vous demandez un tutoriel, une bibliothèque, ce qui n'est pas une question acceptable ici. –
je n'ai pas eu vous @ElTomato – Ram