gpt4 book ai didi

ios - SQLite数据库文件存储在哪里?

转载 作者:行者123 更新时间:2023-12-02 02:29:11 25 4
gpt4 key购买 nike

我有一个 SQlite 数据库文件,其中包含我的应用程序附带的记录。我只是使用添加到项目中的文件来制作 INSERT 和 UPDATE 语句。将其上传到我的测试设备后,我得到了该文件是只读的异常。经过一番研究后,我发现我必须将 db 文件复制到用户目录才能进行插入。目前这有效。但我有一个关于它的 View 问题,我没有通过谷歌得到答案:

我应该把复制过程放在哪里?我在 AppDelegates FinishedLaunching 中实现了它,并在其中检查它是否已经存在。

我应该将文件复制到哪里?我现在使用的是 MyDocuments 文件夹,这样可以吗?

由于文件无法加密,其他应用可以访问该数据库文件吗?

当用户决定从设备中删除应用程序时。数据库文件也会被删除吗?

谢谢!

最佳答案

Where should I put my copy process? I implemented it in the AppDelegates FinishedLaunching, where I check if it already exists.

这确实取决于情况,但从我的角度来看,finishedLaunching 是可以的。

Where should I copy the file to? I used the MyDocuments folder for now, is this ok?

我不确定“MyDocuments”文件夹是什么意思。每个应用程序都有一个专用的文档目录。这就是您应该复制它的地方。

Since the file cannot be encrypted, can another app access the database file?

不,它们在沙盒中运行(除非设备已越狱)

When the user decides to delete the app from the device. Will the database file get deleted,too?

是的,因为整个文档目录将被删除。

关于ios - SQLite数据库文件存储在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8975163/

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