gpt4 book ai didi

cocoa - 本地存储数据

转载 作者:行者123 更新时间:2023-12-03 17:36:32 25 4
gpt4 key购买 nike

在我的应用程序中,我正在从数据库检索数据并在其中显示。在 db 中,某些表包含 1000 多条记录。现在我的要求是即使没有网络连接也显示这些数据,所以我计划将表存储在用户机器上的SQLite db中,但有一个担心:

Since SQLite db will be included within resources folder, in project, so it will be by default contained within application binary. So I want to know that when the application will be launched will all this data reside on RAM ? If yes, then I think this can cause some problems, so in that case- is there any alternative solution to store data locally?

谢谢

米拉杰

最佳答案

不,它不会全部驻留在 RAM 中。应用程序启动时,应用程序包的内容(NIB 文件、图像等)不会全部自动加载到内存中。资源通常按需加载。例如, View Controller 可能调用 initWithNibName: 来加载该 View 的资源。

此外,除非数据库是应用程序的只读部分(除非升级,否则永远不会更改),否则您可能不希望将其存储在应用程序包中 - 请改用应用程序文档目录(尽管您可能会在应用程序包中包含数据库的初始“默认”副本)。请参阅 iOS Application Programming Guide 中的“一些重要的应用程序目录”

关于cocoa - 本地存储数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4568629/

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