• 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: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness


  • Subject: Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
  • From: Jerry Krinock <email@hidden>
  • Date: Mon, 20 Apr 2009 11:02:57 -0700


On 2009 Apr 20, at 04:50, Jerry Krinock wrote:

Problem solved

But there's an even better way. Upon further study of the Predicate Programming Guide, I find that there are even more limitations to Core Data fetches with predicates. The most troubling is that:


"The Core Data SQL store supports only one to-many operation per query; therefore in any predicate sent to the SQL store, there may be only one operator (and one instance of that operator) from ALL, ANY, and IN."

A much better way appears to be to fetch all objects from the store with no predicate and then use -[NSArray filteredArrayWithPredicate:]. This takes only one more line of code, solves all problems, and is supposedly cheaper too:

"If you use the Core Data framework, the array methods provide an efficient means of filtering an existing array of objects without —- as a fetch does —- requiring a round trip to a persistent data store."

Furthermore, now since my left-side expressions don't need to be managed properties I don't need the categories -- I can just add simple derived-attribute getters to my target object class and predicate upon the derived attribute directly.

So, I guess the reason why Apple has never noticed that "Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness" is because there's a better way to do it.

Makes me wonder why NSFetchRequest even supports a predicate, since its predicate has all these limitations and is supposedly more expensive when compared to fetching all objects and then using - [NSArray filteredArrayWithPredicate:] ? It would have saved me a day on the learning curve had it not been there for me to hang myself with.

_______________________________________________

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


  • Follow-Ups:
    • Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
      • From: "Sean McBride" <email@hidden>
    • Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
      • From: Jim Correia <email@hidden>
    • Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
      • From: "Melissa Turner" <email@hidden>
References: 
 >Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness (From: Jerry Krinock <email@hidden>)
 >Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: Compiling a XIB creates a different NIB file everytime
  • Next by Date: Re: C numerical libraries for integrating with Cocoa
  • Previous by thread: Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
  • Next by thread: Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
  • Index(es):
    • Date
    • Thread