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

Predicate Problems


  • Subject: Predicate Problems
  • From: Jeff LaMarche <email@hidden>
  • Date: Tue, 12 Jul 2005 15:03:31 -0400

Hey all. Been using Core Data for a few weeks and really love it. I've encountered a problem today that's just got me stumped, though. It looks like I'm doing exactly what I should be, but am getting an unexpected result.

I'm creating a predicate to bring back all instances with a value in their size attribute greater than or equal to a value entered by the user, like so:

sizePredicate = [NSPredicate predicateWithFormat:@"size >= %@",sizeNum];

In this case, sizeNum is an NSNumber, but I've also tried passing in an NSString, and have also tried using an int and changing the substitution variable to %d; the result is the same no matter which I use. This appears to create a valid predicate, but later when I call

NSArray *array = [context executeFetchRequest:req error:&error];

I get the following entry in the log:

*** -[NSSymbolicExpression compare:]: selector not recognized [self = 0x3980a0]

I do not get an error code in error. If I change the code to work off a different attribute -- a string attribute -- using a string operator, then it works just fine, oddly enough. And, I notice something else - if I print the predicate to the console, with the code above, I get:

SIZE >= 5

but if I do it with a string attribute called "kind", I get:

kind BEGINSWITH "Gr"

I don't know if it's relevant, but it seems odd that it's capitalizing my attribute name in the first case, but not in the second. In my travels thus far with Core Data, I've never before seen it capitalize the attribute name.

Does anybody know what I'm doing wrong?

TIA,
Jeff

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Predicate Problems
      • From: Charilaos Skiadas <email@hidden>
  • Prev by Date: Re: NSUrlResponse
  • Next by Date: Basic bindings questions
  • Previous by thread: Re: NSTreeController and Core Data
  • Next by thread: Re: Predicate Problems
  • Index(es):
    • Date
    • Thread