On 18 Nov 2021, at 19:44, Sean McBride via Cocoa-dev wrote:
> Hi all,
>
> Starting in Monterey, I see a new message logged by Core Data during
> persistent store migration:
>
> NSPredicate: Using NSExpression CAST(x,'Class') is deprecated and will be
> removed in
Hi all,
Starting in Monterey, I see a new message logged by Core Data during persistent
store migration:
NSPredicate: Using NSExpression CAST(x,'Class') is deprecated and will be
removed in a future release. 'MyClassName' should not be cast into a Class
object.'
Thi
I'm looking for a description of the expression syntax that +[NSExpression
expressionWithFormat:] parses, but I can't find anything. There's a whole page
on the _predicate_ format string syntax*, but that only covers the syntax
specific to predicates and ignores expressions. (
On Wed, Mar 16, 2011 at 11:28 AM, Dave DeLong wrote:
> Directly, yes. NSExpression stores a keypath as a single string, whereas
> variables are store in their own kind of NSExpression object. When you
> replace variables with new values, it's only looking for the ce
On Mar 16, 2011, at 11:28 AM, Dave DeLong wrote:
> - If you want to use a keypath with a variable, you could do:
>
> FUNCTION($x, 'text') CONTAINS[cd] $searchString
Or put another way:
FUNCTION($x, 'valueForKeyPath:', 'foo.bar.baz')
Dave
___
Cocoa-
Directly, yes. NSExpression stores a keypath as a single string, whereas
variables are store in their own kind of NSExpression object. When you replace
variables with new values, it's only looking for the certain kinds of
NSExpression objects to replace. Everything else stays the same.
Hi all,
Is it really impossible to create an NSExpression of the form
"$variableName.someKeyPath"? I can create an NSExpression for
$variableName, and I can create an NSExpression for someKeyPath, but I
can't create one that contains both.
The actual problem is that I'm
Thanks for this suggestion, Ben. I ultimately went with a combination of this
suggestion (dynamically determining associativity) and Ronald's suggestion
(allowing the user to choose). My parser will start with the associativity
used by NSExpression, but provides a property to chan
Another option would be to make your code mimic whatever NSExpression is
doing on that machine, by evaluating 2 ** 3 ** 2 (once, and caching the result)
and seeing whether it comes out as 64 or 512. That way if/when Apple fixes
their bug, your code will seamlessly follow suit.
Which of
** 3 ** 2". I can run this through
> NSPredicate to parse it into an NSExpression tree for me, like so:
>
> NSExpression * e = [(NSComparisonPredicate *)[NSPredicate
> predicateWithFormat:@"2 ** 3 ** 2 == 0"] leftExpression];
>
> When I log/evaluate this predicate
Hi everyone,
Let's say I have the string @"2 ** 3 ** 2". I can run this through NSPredicate
to parse it into an NSExpression tree for me, like so:
NSExpression * e = [(NSComparisonPredicate *)[NSPredicate
predicateWithFormat:@"2 ** 3 ** 2 == 0"] leftExpression];
Hi Joanna,
I'm still not getting anywhere. Any chance you could send me your test project
or post it somewhere? It would be very helpful.
Thanks
Chris
On May 12, 2010, at 2:39 AM, Joanna Carter wrote:
> Hi Chris
>
>> I am on OS X 10.6, XCode 3.2.2, GC and Core Data. I have a single entity a
Hi Chris
> I am on OS X 10.6, XCode 3.2.2, GC and Core Data. I have a single entity app
> where I subclassed NSManagedObject so I can generate a "Job Ticket ID" for my
> Job entity whenever a new Job is inserted. However I am getting an error in
> my Log that is complaining that...
>
> -[NSCFN
Context]];
[theRequest setEntity:theEntity];
[theRequest setResultType:NSDictionaryResultType];
// Create an expression for the key path.
NSExpression *theKeyPathExpression = [NSExpression
expressionForKeyPath:@"myID"];
NSExpr
ide.
>
> Dave
>
> On Apr 2, 2010, at 3:42 PM, Ben Trumbull wrote:
>
>> NSComparisonPredicate* exprPred = (NSComparisonPredicate*)[NSPredicate
>> predicateWithFormat:@"SUBQUERY(self, $key, %...@.$key != nil) == 0", obj];
>> NSExpression* exp
redicate
> predicateWithFormat:@"SUBQUERY(self, $key, %...@.$key != nil) == 0", obj];
> NSExpression* expr = [exprPred leftExpression];
> NSLog(@"expression subquery results = %@", [expr
> expressionValueWithObject:keys context:nil]);
smime.p7s
Des
sults = %@", [keys
filteredArrayUsingPredicate:pred]);
NSComparisonPredicate* exprPred = (NSComparisonPredicate*)[NSPredicate
predicateWithFormat:@"SUBQUERY(self, $key, %...@.$key != nil) == 0", obj];
NSExpression* expr = [exprPred leftExpression];
NSLog(@"expres
ate where the "target" is really the
base object, and the keys are applied one by one against this target
(think a NSExpression using a keyPath], and the result is a smaller array.
I suspect it can be done but have not figured out how to do it yet. The
stumbling block is that the ta
> Objects:
> - NSManagedObject *item - some managaged object
> - NSArray *attributes - an array of the item's attributes
>
> Desired Result:
> - a possibly smaller array of attribites where [item valueForKey: attribute>] != nil.
>
> In code, I can simply iterate over the keys, perform the valu
I can't think of a way to do this without iterating over the entire array. It
*might* be possible using key-value coding and fancy keypaths and whatnot, but
iteration is going to be far simpler to implement and understand.
Dave
On Apr 2, 2010, at 8:27 AM, David Hoerl wrote:
> Objects:
> - NSM
Objects:
- NSManagedObject *item - some managaged object
- NSArray *attributes - an array of the item's attributes
Desired Result:
- a possibly smaller array of attribites where [item valueForKey:attribute>] != nil.
In code, I can simply iterate over the keys, perform the valueForKey,
and s
I'm left wondering "Under what circumstances would +[NSExpression
expressionForFunction:selectorName:arguments:] be useful.
An example would be helpful, but I sure wasn't able to find one.
Meanwhile, I switched to a simple bounds check, which works just fine.
Thanks for your t
On 2009 Nov 27, at 12:23, Ron Aldrich wrote:
> but I'd very much like to understand why this isn't working.
>
> On Nov 25, 2009, at 11:34 PM, Alexander Spohr wrote:
>
>> I am not sure if that works at all. I never fetched using methods that are
>> not part of the database as a qualifier.
The
n
>> information for all of the objects of type "Photo" which are within a
>> specified distance of a target point, using the following code.
>>
>> - (NSArray*) photosNearLatitude: (NSNumber*) inLatitude
&
'm trying to query a Core Data database which contains geoLocation
> information for all of the objects of type "Photo" which are within a
> specified distance of a target point, using the following code.
>
> - (NSArray*) photosNearLatitude: (NSNumber*) inLatitude
>
er*) inLatitude
longitude: (NSNumber*) inLongitude
{
NSExpression *theLHS = [NSExpression expressionForFunction: [NSExpression
expressionForEvaluatedObject]
selectorName:
@"distanceFromLatitude:longitude:"
On 2009 May 22, at 13:54, Ben Trumbull wrote:
Uhm, No. %@ is the vararg specifier for an NSObject. -
stringWithFormat: turns that into a string. Because -
stringWithFormat: turns everything into a string. Kinda the point.
-predicateWithFormat: does NOT call -description randomly.
Pred
On 2009 May 17, at 15:10, Ben Trumbull wrote:
Core Data supports == and != searches against binary data. You
should be able to just use a predicate like:
[NSPredicate predicateWithFormat:@"myTransformableAttribute = %@",
myGuidObject]
and have it "just work".
Read the above carefully!
myGu
ck!!
Months ago, I wrote code with using -[NSComparisonPredicate
predicateWithLeftExpression:rightExpression:modifier:type:options:].
I used -[NSExpression expressionWithConstantValue:] to create the
expressions. The left expression value was the name of an attribute
which is of type &q
NSExpression contains the following mysterious information:
"All methods must take 0 or more id arguments and return an id value, although
you can use the CAST expression to convert datatypes with lossy string
representations (for example, CAST(, "NSDate")). The CAST
express
On Jun 28, 2008, at 11:35 PM, Chris wrote:
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:@"l
On Jun 28, 2008, at 10:35 PM, Chris wrote:
NSExpression * ex = [NSExpression expressionForFunction:
[NSExpression expressionForConstantValue:@"BAR"]
selectorName:@"length" arguments:nil];
NSPredicate * predicate = [NSCompoundPredicate
andPredicateWithSubpredicates:[NSA
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 * predica
On Jun 28, 2008, at 12:13 AM, Chris <[EMAIL PROTECTED]> wrote:
NSExpression defines this method:
+ (NSExpression *)expressionForFunction:(NSString *)name arguments:
(NSArray *)parameters
and the doco provides this example:
[NSExpression expressionForFunction:(@selector(
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
35 matches
Mail list logo