• 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: Weird NSPredicate structure when using "first" in keypath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird NSPredicate structure when using "first" in keypath


  • Subject: Re: Weird NSPredicate structure when using "first" in keypath
  • From: Chris Hanson <email@hidden>
  • Date: Tue, 17 Jan 2017 19:18:39 -0800

On Jan 9, 2017, at 8:29 PM, Jens Alfke <email@hidden> wrote:
> On Jan 9, 2017, at 6:38 PM, Aaron Tuller <email@hidden> wrote:
>> Try doing
>> name.#first
>> as FIRST and LAST are reserved words and need escaping:
>
> Thanks for the answer. Unfortunately this is a library that will allow developers to provide their own predicate strings, and I can imagine this causing confusion (and therefore support requests for us.)
>
> I added a workaround to my code that will recognize the weird predicates formed by using unescaped ‘first’ and ‘last’, and handle them appropriately. I hope that’ll be robust enough!

If that's the case, why not just provide your library's API in terms of NSPredicate objects?

Then if your users want to use a predicate string (rather than an NSPredicateEditor or other form of direct instantiation) they still trivially can, but it's on them to get the syntax correct rather than on you to try to figure out their intent.

  -- Chris


_______________________________________________

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: Weird NSPredicate structure when using "first" in keypath
      • From: Jens Alfke <email@hidden>
References: 
 >Weird NSPredicate structure when using "first" in keypath (From: Jens Alfke <email@hidden>)
 >Re: Weird NSPredicate structure when using "first" in keypath (From: Aaron Tuller <email@hidden>)
 >Re: Weird NSPredicate structure when using "first" in keypath (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: On NSIncrementalStore UUID Uniqueness
  • Next by Date: Re: Weird NSPredicate structure when using "first" in keypath
  • Previous by thread: Re: Weird NSPredicate structure when using "first" in keypath
  • Next by thread: Re: Weird NSPredicate structure when using "first" in keypath
  • Index(es):
    • Date
    • Thread