• 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
Core Data NSPredicate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data NSPredicate


  • Subject: Core Data NSPredicate
  • From: Indragie Karunaratne <email@hidden>
  • Date: Fri, 11 Mar 2011 19:36:25 -0700

I have an NSManagedObject that has the following string attributes:

artist, albumArtist, composer, comments, and lyrics

I need to write an NSPredicate that will take an array of search terms, and check if all of the above string attributes COMBINED contains every term in the search term array. I tried the following predicate format:

NSArray *searchTerms = [NSArray arrayWithObjects:@"testing", @"search", nil];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ALL %@ IN { artist, albumArtist, composer, comments, lyrics }", searchTerms];

This triggered a parsing error and would not run. Is there any way I can do this in an NSPredicate, aside from creating a "search string" attribute in my data model containing a concatenated string of the above attributes?

Thanks_______________________________________________

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 NSPredicate
      • From: Andreas Grosam <email@hidden>
    • Re: Core Data NSPredicate
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: Unique strings array
  • Next by Date: Re: Unique strings array
  • Previous by thread: Re: Unique strings array
  • Next by thread: Re: Core Data NSPredicate
  • Index(es):
    • Date
    • Thread