Check JSON feed for updates
I have a JSON feed, and everything works well. However, I want to do a check if there´s any updates in the JSON feed. For instance that something is added to the JSON feed, and display the number of updates as a badge value for my tab bar item.
What wo开发者_如何学Gould be the best way to do this? Should I save the count of the array from the JSON feed in i.e core data, and compare the count between the number of objects in core data with the number of objects in my JSON feed array?
I would appreciate any help to point me in the right direction.
Your approach should work but using coredata for this is a little overkill. You can store and retrieve the value simply:
[[NSUserDefaults standardUserDefaults] setInteger:objectCount forKey:@"jsonObjectCount"];
[[NSUserDefaults standardUserDefaults] integerForKey:@"jsonObjectCount"];
精彩评论