3

我正在为当前在线运行的 Web 应用程序开发 iPhone 应用程序。当前的 Web 应用程序使用 txt 文件来保存数据。当前系统使用自己的标准将数据保存在文件中,并且还制定了自定义算法来读取和写入数据。每个 txt 文件的大小低于 1 mb。有很多数据操作正在进行。

那么在实现相同的同时我想为 iPhone 应用程序选择什么?在苹果网站上,他们说'SQLite 非常适合低级关系数据库工作' https://developer.apple.com/technologies/ios/data-management.html 但在我的情况下它是高级别的。

所以请帮我做决定。我想使用核心数据管理文件或 sqlite 数据库中的数据吗?每个的优点和浓度是什么?使用文件时是否存在内存问题或性能问题?

编辑 09/02/2013


感谢您的回答'user76859403'。当前的 Web 应用程序也使用数据库来保存重要信息,如成员详细信息、登录凭据等,其他内容保存在文件中。在当前系统中有不同的部分,所有这些部分都有几个子部分和相关信息。这些部分及其详细信息保存在文件中。创建的自定义算法只是读取这些文件并将所有数据作为记录放入缓存中(与核心数据 managedobjectcontext 中相同),并且每当数据发生变化时,整个文件都会被覆盖。我还想知道是否可以将 webserver 中使用的那些类和算法导入 iOS,这样我就可以节省时间为 iOS 重写相同的算法?当前的服务器代码是 C#

4

2 回答 2

3

First, I must say that I find it odd that the web-server is storing its data in text files and having customized algorithms to manipulate the data. Giving that lots of data manipulation are occurring, this seems highly inefficient to me; a database would be better in my opinion.

From your side however, it all depends on the data you're processing from the server. You can use the following:

  1. SqlLite or CoreData - Using these approaches is one route to go. But you may have the extra work of sorting out the data into tables etc.. usual database stuff. Refer to the answer on this link to get a better idea on the difference between the SqlLite and CoreData or Google a bit.

  2. Just save the data in files just like its being done on the server. There are several ways to do this including Property List files etc. Here's one method where it's being done using NSCoding.

I would say that the approach#1 approach has the advantage in organization and speed (has the advantage any relational database would have). However, the disadvantage is you will take more time properly setting up this correctly.

Approach#2 might save you time as you would not have to consider structure of data or anything, just dump and save. However, ask yourself, is the size of server data liable to increase? is speed a factor in processing? etc etc.. Think about long term, not just the short fix. This approach is right for you if the data will be relative the same and load is small.

The approach you choose largely depends on your data load and furture project scope (be it quick fix, or longer term improvement of current system) in my opinion.

于 2013-02-07T13:31:26.580 回答
0

如果您正在处理任何“高级”问题,我强烈建议您使用 Core Data。还可以查看 mogenerator https://github.com/rentzsch/mogenerator。这个很棒的教程应该可以帮助您入门:http ://www.raywenderlich.com/934/core-data-on-ios-5-tutorial-getting-started

  • 约翰内斯
于 2013-02-07T12:44:34.310 回答