我是否需要启用WAL模式才能将.SQLite从分发包复制到文档目录? [英] Do i need to Enable WAL mode to copy .SQLite from bundle to Document directory?

查看:79
本文介绍了我是否需要启用WAL模式才能将.SQLite从分发包复制到文档目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的应用程序仅复制.sqlite文件(WAL MODE = DELETE)
一切进展顺利,新复制的myfile.sqlite也完美地包含了数据。

My current application only copying .sqlite file (WAL MODE = DELETE). Everything went smoothly , the new copied myfile.sqlite also contain data perfectly.

当我执行获取请求时,执行没有错误,并且BOOL(成功)为1。但是返回的数组始终为空。

When I execute a fetch request , the execution has no error , and BOOL (success) is 1 . BUT the returned array always EMPTY.

https://www.appcoda.com/core-data-preload-sqlite-database/

本教程告诉我将3个文件( .sqlite,.sqlite-wal,.sqlite-shm )复制到文档目录中。

This tutorial told me I neeed to copy 3 files (.sqlite , .sqlite-wal , .sqlite-shm) in to Document directory .

这是否意味着我需要启用WAL模式并从头开始重新执行所有操作?在Xcode 10中,我们仍然不能仅复制1个.sqlite文件?有人可以澄清吗?

Does this mean I need to Enable WAL mode and re-do everything from the start? In Xcode 10 we still cannot copy just 1 .sqlite file? Can someone clarify this?

推荐答案

假设您是指日记模式,而不是 WAL MODE (并且您的意思是Xcode 8.x,因为Xcode 10还不存在),因此您不需要复制任何其他文件或更改模式。日志模式设置为 DELETE 时,只有一个文件。您不需要创建额外的文件即可进行复制。

Assuming that you mean journal mode, and not WAL MODE (and that you mean Xcode 8.x, since Xcode 10 doesn't exist yet), no you do not need to copy any additional files or change modes. With journal mode set to DELETE there's only the one file. You don't need to create extra files to make copying work.

但是您可能还会遇到其他一些问题,应该检查并在必要时发布。有关以下其他问题:

But there are several other problems you might be having, which you should check on, and if necessary post additional questions about:


  • 也许复制阶段实际上并没有您想象的那么完美。

  • 也许您没有将SQLite文件添加到持久性存储协调器中,所以在进行获取时不可用。

  • 也许您的获取配置错误,并试图获取数据

不过对于您的问题,不,您不需要复制其他文件或更改日记模式强制其他文件存在。

As for your question though, no you do not need to copy other files, or change the journal mode to force those other files to exist.

这篇关于我是否需要启用WAL模式才能将.SQLite从分发包复制到文档目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆