开发者

iPhone Core Data updating records

I'm trying to find a solution to what I think has to be a simple problem. I'm using coredata to m开发者_JAVA百科aintain a list of bookmarks in my app. there are only three fields being stored, bid, order and title.

in some cases I want to update an existing record. currently I'm using a predicate to search for a particular bid. the problem I'm having is accessing the record as an object so it can be updated and resaved.

any help? also, are there any guidelines for how much data should be stored in a plist or user default?

a user can potentially have hundreds of bookmarks.

thanks,

howie


Fetched results come back as a set. If there is only a single result, you could call anyObject on the set to obtain the actual managed object. Post some code if you want some detailed help.

Core Data is the right solution here, so don't resort to plists or user defaults.


The fetched results are returned as an instance of NSSet. Get the object you want to change (either with anyObject or objectAtIndex: or you can loop through the whole set) and then change the property you want. Then just call the function "save:" on your managedObjectContext.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜