我发现iOS上的Phonegap/Cordova应用程序正在保存我用相机拍摄的所有照片并将它们上传到服务器.
在"使用"点击下的iPhone设置中,即使在退出应用程序后,我的应用程序和所需的磁盘大小也在增加.
那么在将其上传到我的服务器后,如何删除这些临时文件或图片本身呢?我使用pictureURI找到它进行上传.
编辑:谢谢.我已经实现了代码,现在它看起来像这样:
在我的fileupload函数中,我添加了这一行:
window.resolveLocalFileSystemURI(fileURI, onResolveSuccess, faillocal);
Run Code Online (Sandbox Code Playgroud)
其他功能如下:
function onResolveSuccess(fileEntry) {
console.log(fileEntry.name);
entry.remove(entrysuccess, failresolve);
}
function entrysuccess(entry) {
console.log("Removal succeeded");
}
function failresolve(error) {
alert('Error removing directory: ' + error.code);
}
function faillocal(evt) {
console.log(evt.target.error.code);
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用.文件已上传,但没有警报,没有控制台写入,根本没有删除...
| 归档时间: |
|
| 查看次数: |
4899 次 |
| 最近记录: |