- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在探索在我正在构建的应用程序上存储文件的不同选项,但是我注意到手机间隙中存在不同的文件结构,并且不知道哪个是最新的。
使用: alert(JSON.stringify(fileSystem.root));
我可以看到 fileSystem.root.nativeURL
是 file:///var/mobile/Containers/Data/Application/APPID/Documents,但找不到 cdvfile://localhost 所在位置。
这是应用程序的根目录吗?fileSystem.root.nativeURL 是否仍用于将文件添加到应用程序的文档文件夹?
谢谢
-- 当前代码--
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
alert(JSON.stringify(fileSystem.root));
return;
fileSystem.root.getFile("readme.txt", {create: true}, gotFileEntry, fail);
}
最佳答案
如果您使用的是 Android 手机,那么您是否将定义存储位置类型,例如内部或外部
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
然后它将文件保存到内部或外部存储的根目录。
如果您使用的是 ios,那么您必须安装 itunesfilesharing将共享应用程序文档文件夹中的文件的插件。这里是 config.xml
<preference name="iosPersistentFileLocation" value="Documents" />
<preference name="iosPersistentFileLocation" value="Compatibility" />
关于javascript - Phonegap/Cordova - cdvfile ://localhost in terms of the app root? 在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38789210/
问题: 在我的应用程序中,我想通过 cordova wkwebview 访问图像。HTML 元素如下所示。 加载时,出现错误“无法加载资源:不支持的 URL”。我正在使用 iOS 10.2。 已验证
为了轻松更新我的应用程序,我将 www 文件夹的内容复制到手机,然后执行 window.location = workingDirectory.toURL() + "/index.html" . 编辑
我目前正在使用 phonegap 开发一个应用程序,我想更新我在 wordpress 上的应用程序的内容。通过 JSON API,我获得了页面的 html 内容,但问题是让用户选择图像。我所做的是从
我正在使用 cordova-plugin-camera 通过这些选项拍照: quality: 100, destinationType: Camera.DestinationType.NATIVE_U
我在 angular/ionic/cordova 应用程序中显示下载到 cordova.file.dataDirectory 的图像时遇到问题。 我正在使用 cordova-plugin-file,我
我目前正在探索在我正在构建的应用程序上存储文件的不同选项,但是我注意到手机间隙中存在不同的文件结构,并且不知道哪个是最新的。 使用: alert(JSON.stringify(fileSystem.r
我的应用程序使用 FileAPI 复制设备上的文件.这在 Phonegap 3.4.0 和 3.5.0 中运行良好。 然后它通过执行 window.location = "cdvfile://loca
我的 Cordova 应用程序从服务器下载音频文件,并使它们可以在设备离线时播放。直到昨天我升级到最新版本时一切正常。 最初,下载(通过文件传输插件)和播放(通过媒体插件)都不起作用。进一步研究我发现
我是一名优秀的程序员,十分优秀!