简体   繁体   English

储存大量数据的最佳方法

[英]Best Way To Store Tons of Data

I'm working on an application that will need to pull from a list of data depending on where the user is located in the US. 我正在开发一个应用程序,该应用程序将需要从数据列表中提取数据,具体取决于用户在美国的位置。 In a sense, I will have a database full of information based on their location, and a condition statement will determine while value from the list to use. 从某种意义上说,我将拥有一个基于其位置而充满信息的数据库,并且条件语句将确定列表中要使用的值。

Example of data: 数据示例:

Tennessee: 田纳西州:

   Data2 = 25;
   Data3 = 58;
   ...

Texas: 得克萨斯州:

   Data2 = 849;
   Data3 = 9292;
   ...

So on... 等等...

My question is, what is the best practice to use when developing iOS apps and you have a lot of data? 我的问题是,在开发iOS应用程序且您拥有大量数据时,最佳实践是什么? Should you just put all the related data in a file, and import that file when you need to like normal, or is there another method you should use? 您是否应该仅将所有相关数据放入文件中,并在需要使用普通文件时将其导入,还是应该使用其他方法? I know they state you should follow the MVC practice, and I think in this case my data would be considered the Model, but just want to double check if that applies here. 我知道他们说您应该遵循MVC惯例,并且我认为在这种情况下,我的数据将被视为模型,但只想仔细检查一下是否适用于此。

You have some options here: 您在这里有一些选择:

  • SQLite database SQLite数据库
  • Core Data (its not a relational database model like sqlite) 核心数据(它不是像sqlite这样的关系数据库模型)
  • write to plain text file. 写入纯文本文件。 (using NSFileManager ) (使用NSFileManager)
  • NSKeyedArchiever NSKeyedArchiever

If you want to frequently keep appending data to a single file, I would recommend using sqlite fast and robust. 如果您想经常将数据追加到单个文件中,建议使用sqlite快速且健壮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM