我想用Google Drive API下載音頻文件(mp3,m4a,wma ...)。嘗試下面的代碼,我得到了模擬器上的錯誤。如何下載音頻文件?
錯誤:
The operation could't be completed. (The user has not granted the app xxxx read access to the file alEnlflseiFNSEi.)
代碼:
let url = "https://www.googleapis.com/drive/v3/files/\(identifier)?alt=media"
service.fetchObject(
with: URL(string: url)!,
delegate: self,
didFinish: #selector(GoogleDriveFileListTableViewController.downloadWithTicket(ticket:finishedWithObject:error:))
)
// Parse results and display
func downloadWithTicket(ticket : GTLServiceTicket, finishedWithObject response : GTLDriveFileList, error : NSError?) {
if let error = error {
showAlert(title: "Error", message: error.localizedDescription)
return
}
}
感謝。我知道了。 我發現了錯誤。在URL中不需要?alt = media。 – yongwoon
我檢查網站的回覆。 – yongwoon