Storing data locally
In my application I am retrieving data from database and showing in it. In db some of the tables contain 1000+ records. Now my requirement is to show this data even if there is no net con开发者_开发知识库nection, so I am planning to store the tables in SQLite db at user's machine, but there is a worry:
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?
Thanks,
Miraaj
No, it won't all reside in RAM. The contents of the application bundle (NIB files, images, etc.) are not all automatically loaded into memory when the app is launched. Resources are typically loaded on demand. For example, a view controller might call initWithNibName:
to load the resources for that view.
Also, unless the database is a read-only part of the application (never changes unless you upgrade), you probably don't want to store it in the app bundle -- use the application documents directory instead (although you might include an initial "default" copy of the database within the app bundle). See "A Few Important Application Directories" in the iOS Application Programming Guide
精彩评论