我正在尝试发布一个用 Ionic Cordova 编写的应用程序,但我遇到了应用程序功能之一的问题。特别是,有一个按钮可以让你下载一个在 android 版本中完美运行的文件,但在 iOS 中我得到这个错误:
FileTransferError { body = "Could not create path to save downloaded file: The file \U201c\U201d couldn\U2019t be saved."; code = 1; "http_status" = 200; source = "https://player.vimeo.com/external/221750072.sd.mp4?s=4dd5a5319a2484a715c54f58ef5b0e53&profile_id=165&download=1"; target = "null.CHURCHOF%20SAINT%20JOHN.mp4"; } File Transfer Error: Could not create path to save downloaded file: The file “” couldn’t be saved.
最佳答案
您如何制定目标路径?您正在使用的某些属性似乎是 null
,因此您应该修改它以获得有效的目标路径。例如,我为此目的使用如下结构:
var destPath = (cordova.file.externalDataDirectory || cordova.file.dataDirectory)
+ "path_to_destination"
然后是文件传输插件:
var ft = new FileTransfer();
ft.download(url, destPath, success, error, true);
关于ios - 无法创建保存下载文件的路径 - Ionic iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46399641/