Difference between core data & NSUserDefaults-notes app

心不动则不痛 提交于 2019-12-12 14:36:08

问题


Creating a budget app (not for release, just something quick & dirty) and I noticed upon starting the Master-Detail template that Apple uses Core Data and NSFetch results to populate the tables (think Notes on an iPad).

My inexperienced and unprofessional programming instincts wouldn't think twice about grabbing an NSMutableArray, taking the names of the table cells and cramming them into an index, saving that as an NSUserDefault and then upon reloading the app, populate each cell at it's current index with the same index in the NSMutableArray so the contents is back where the user left it. Just wondering, how inefficient is this compared to using Core Data?

On a side note, any easy way of communicating between two different tables that both hold dynamic data?


回答1:


Up to a few hundred records, don't worry about it. It would be indeed wonderfully "quick and dirty".

Still, the learning curve for Core Data is not as steep as you might expect. Once you get the hang of it - and your simple app is great way to explore that API - you will find that you want to do everything with it. Even large projects will seem easy.

Your choice.



来源:https://stackoverflow.com/questions/24970074/difference-between-core-data-nsuserdefaults-notes-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!