相关疑难解决方法(0)

应用缓存iOS PhoneGap

在我使用的Android上

file:///storage/sdcard0/Android/data/my.app.id/cache/
Run Code Online (Sandbox Code Playgroud)

下载(FileTransfer)一些图像,然后在我的HTML中显示它们.删除我的应用程序时,图像和此文件夹中的所有内容都将被删除,这正是我想要的.

如何在iOS上实现这一目标?

我试过了

file:///var/mobile/Applications/<GUID of app>/Documents/
Run Code Online (Sandbox Code Playgroud)

因为这是我在请求文件系统时得到的,但图像甚至不会下载(错误代码1).有任何想法吗?我发现了更多关于我的错误:这是与问题中所述相同的错误.(无法创建保存下载文件的路径 - Cocoa Error 512)

谢谢


更多信息: 我使用的相关插件是

<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.file-transfer" />
Run Code Online (Sandbox Code Playgroud)

和功能:

<feature name="File">
    <param name="android-package" value="org.apache.cordova.file.FileUtils" />
</feature>
<feature name="File">
    <param name="ios-package" value="CDVFile" />
</feature>
<feature name="FileTransfer">
    <param name="ios-package" value="CDVFileTransfer" />
</feature>
Run Code Online (Sandbox Code Playgroud)

我在Android中成功下载图片:

var fileTransfer = new FileTransfer();    
var uri = encodeURI("myserverurl/"+fileName); 
var filePath = appCachePath+fileName;  
        fileTransfer.download(
            uri,
            filePath,
            function(entry) {
                alert("download complete: " + entry.fullPath); 
            },
            function(error) {  
                alert("download error source/target/code:\n" + error.source …
Run Code Online (Sandbox Code Playgroud)

android ios cordova phonegap-build

6
推荐指数
1
解决办法
4016
查看次数

标签 统计

android ×1

cordova ×1

ios ×1

phonegap-build ×1