• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Counting instances in Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Counting instances in Core Data


  • Subject: Re: Counting instances in Core Data
  • From: Ben Trumbull <email@hidden>
  • Date: Tue, 29 Apr 2008 13:57:35 -0700

> In Tiger that was the best means available, but if you're targeting Leopard
 there is a better option available:

  Create your fetch request to fetch all instances of a given entity and
 execute the fetch with countForFetchRequest:error: which will simply return
 the number of instances/rows that match your query.

Though Steve mentioned off-list that he's targeting Tiger, I had managed to completely forget about this method - my apologies for the misinformation.

Well, it's probably best to ask the NSManagedObjectContext -respondsToSelector:@selector(countForFetchRequest:error:) and use the slow -executeFetchRequest:error: if the result is NO.


--

-Ben
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: PerlObjCBridge and SFAuthorization
  • Next by Date: Re: How to adopt a superclass's protocol?
  • Previous by thread: Re: Counting instances in Core Data
  • Next by thread: Binding a popup button's selected index to a model integer
  • Index(es):
    • Date
    • Thread