• 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: NSExpression
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSExpression


  • Subject: Re: NSExpression
  • From: Chris <email@hidden>
  • Date: Sun, 29 Jun 2008 15:35:48 +1000


If anyone has a clue how to use it, I'd be grateful. This was my unsuccessful attempt:


NSExpression * ex = [NSExpression expressionForFunction:[NSExpression expressionForConstantValue:@"BAR"] selectorName:@"length" arguments:nil];

NSPredicate * predicate = [NSCompoundPredicate
    andPredicateWithSubpredicates:[NSArray arrayWithObject: ex]];

[predicate evaluateWithObject:@"FOO" substitutionVariables:nil];

[NSFunctionExpression evaluateWithObject:substitutionVariables:]: unrecognized selector sent to instance 0x68b8af0


On 29/06/2008, at 12:43 AM, Shawn Erickson wrote:

On Jun 28, 2008, at 12:13 AM, Chris <email@hidden> wrote:


NSExpression defines this method:

+ (NSExpression *)expressionForFunction:(NSString *)name arguments: (NSArray *)parameters

and the doco provides this example:

[NSExpression expressionForFunction:(@selector(random)) arguments:nil];


Isn't that wrong? Can you really pass a selector to a NSString argument? The compiler is complaining, and the program crashes when I attempt.

Yeah it is wrong. I believe you just pass a string with the same contents as what you would put in @selector.


-shawn

_______________________________________________

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: NSExpression
      • From: Nathan Kinsinger <email@hidden>
    • Re: NSExpression
      • From: mmalc crawford <email@hidden>
References: 
 >NSExpression (From: Chris <email@hidden>)
 >Re: NSExpression (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Building a Setup Assistant
  • Next by Date: Re: Building a Setup Assistant
  • Previous by thread: Re: NSExpression
  • Next by thread: Re: NSExpression
  • Index(es):
    • Date
    • Thread