gpt4 book ai didi

javascript - Phonegap/Cordova - cdvfile ://localhost in terms of the app root? 在哪里

转载 作者:行者123 更新时间:2023-11-28 05:42:45 25 4
gpt4 key购买 nike

我目前正在探索在我正在构建的应用程序上存储文件的不同选项,但是我注意到手机间隙中存在不同的文件结构,并且不知道哪个是最新的。

使用: 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com