iphone - Checking for existing value in NSFetchedResultsController / Core Data -


i have code calls api , gets set of results back, let's call them 'message' objects. each message has unique id.

unfortunately, cannot guarantee server not give me message have not received , stored in core data database.

the unique id set nsnumber field in 'message' entity.

is there way 'on-the-fly' check database see if 'message' exists given unique id?

currently i'm creating instance of helper object each time need check, , creating nsfetchedresultscontroller returning filtered results via nspredicate. if results returned, move on, or store in database. suspect slow approach...

any help?

looks need:

nsuinteger count = [self.managedobjectcontext countforfetchrequest:fetchrequest error:&error]; 

this gives me count without doing query - better.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -