v2.3.4版本, 在 ios14上每次启动APP调用函数jsb.fileUtils.getWritablePath()得到的路径都不同,如何解决?

  • Creator 版本:

  • 目标平台:

  • 重现方式:

  • 首个报错:

  • 之前哪个版本是正常的:

  • 手机型号:

  • 手机浏览器:

  • 编辑器操作系统:

  • 重现概率:

有没有其他人遇到类似的情况呀?

iOS 沙盒机制. 目录还是那个目录. 只是路径变了.
需要持久化 路径的时候, 只记住 相对目录,使用的时候拼接一下

能详细说一下吗?
我是在热更新的时候 jsb.fileUtils.setSearchPaths 路径不管用遭遇的此问题,官方的demo就是这么写的,但是不起作用了,以前没问题

我看明白了你的意思,我去试一下,只是奇怪官方热更新的demo怎么运行通过的

你这属于重新安装APP了,如果是装好的APP,每次重启沙盒路径是不变的。

我用xcode调试的时候选择的是不构建只运行app,路径确实是变化的,这没有重新安装APP吧?

是重装了的

好的,谢谢,我再去验证一下.
另外有个相关的问题:覆盖安装app这个路径会变化吗?

反正 在 iOS 上不要用完整路径,

重启设备,升级系统,覆盖安装 都有可能变化.

Important: Although they are safe to use while your app is running, file reference URLs are not safe to store and reuse between launches of your app because a file’s ID may change if the system is rebooted. If you want to store the location of a file persistently between launches of your app, create a bookmark as described in Locating Files Using Bookmarks.

https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/AccessingFilesandDirectories/AccessingFilesandDirectories.html#//apple_ref/doc/uid/TP40010672-CH3

1赞

十分感谢你的回答,这对我很有用