ios5 核心数据或偏好列表
q) 存储人员完整详细信息的最佳方法是什么,即
steve >详细信息包含:姓名、地址、出生日期、其他详细信息等。 约翰>详细信息包含:姓名、地址、出生日期、其他详细信息等。
更多记录最多约为 200 条。
现在我想单独显示这些,并可以选择添加它们,建议的方式是什么?
我查看了核心数据、userdefaults 和 NSFileManager,但不确定实现此类嵌套文本保存和加载的最佳方法是什么。
q) what is the best method of storing persons complete details i.e.
steve > details contain :name address,dob, other details etc..
john > details contain :name address,dob, other details etc..
and many more records max would be around 200 tops.
now i want to display these individually and with the option to add them what is the suggested way?
i had a look at core data,userdefaults and NSFileManager but not sure what would be best way to implement such nested texts for save and load.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想搜索或查询它们,我总是建议从一开始就使用核心数据。
您最终只会希望在几个月内沿着这条路线走下去,然后就必须考虑迁移。
对于核心数据,我在新项目中使用 https://github.com/magicalpanda/MagicalRecord ,它可以完成大部分工作为您承担繁重的工作。
对于最近的应用程序,我使用了 NSUserDefaults。基本上将我所有的“人”对象作为 NSDictionaries 保存在 NSArray 中。这适合该应用程序,因为数据量较低,最多使用 c100 条记录。
我可以轻松地使用保存到磁盘的方法,但由于我没有任何其他用途来保存少量的首选项数据,所以这只是一种方便。
(请记住,访问 NSUserDefaults 将返回其所有内容,而不仅仅是您感兴趣的特定对象)。
希望这有帮助。
if you want to search or query them I would always recommend going with core data from the get go.
You'll only end up wishing you add gone down that route in a few months and then would have to factor in a migration.
For core data I use https://github.com/magicalpanda/MagicalRecord for new projects, it does most of the heavy lifting for you.
For a recent app I used NSUserDefaults. Basically keeping all my 'person' objects as NSDictionaries in an NSArray. This suited the app as the data was low, c100 records in use max.
I could just as easily have used a save to disk method, but as I did't have any other use for saving small amounts of preference data, it was just a convenience.
(remember, accessing NSUserDefaults brings back all its contents, not just the particular object you are interested in).
Hope this helps.