I want to build an app that I can fetch notifications from server and save notification inside client devices for limitation only(50 Messages).But,I want to know that I need to use CoreData
to store the data fetch from Server inside client app or not?If it is not,what should I use?I really need a hand to pick me up.Thanks.
Note: I only want to store 50 Notifications only inside UITableView
Any help?Please
我认为您应该使用 Coredata,如果您的列表通知计数 > 50,这很简单,您可以在打开应用程序时删除第一个对象并将新通知添加到列表的最后一个,您可以从 coredata 中获取通知并排序时间,您可以使用coredata的notificationModel中的变量is_view来检测它是否正在查看...
The intended use of core data is to store complex entities and large set of data with relationships. But since your data set is simple and small, it will be a better approach to use Plist
files to store notification json.
Plist downside over NSUserDefaults: The downside of Plist
files over NSUserDefaults
is you have to write some extra code for file management (Copy/Read/Write).
Plist upside over NSUserDefaults: It separates your data from NSUserDefaults
.plist file, which holds some other application related data.
If you don't want to code more then simply go with NSUserDefaults
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.