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

Re: Predicate and beginswith


  • Subject: Re: Predicate and beginswith
  • From: Shawn Erickson <email@hidden>
  • Date: Tue, 22 May 2007 07:02:06 -0700


On May 21, 2007, at 9:43 PM, Joel Levin wrote:

Hi Brian,

The following code works perfectly as expected:

NSString* arg = @"<htm";

NSMutableArray* array = [NSMutableArray array];
[array addObject:@"<html>"];
[array addObject:@"<form>"];

NSPredicate* predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[cd] %@", arg];
NSArray* filtered = [array filteredArrayUsingPredicate:predicate];

NSLog(@"%@", array);
NSLog(@"filtered by: %@", arg);
NSLog(@"%@", filtered);


The only difference here is that in your code you are setting allKeys back to the result of running a method on allKeys with this line:
allKeys = [allKeys filteredArrayUsingPredicate:stringToCompletePredicate];


Try created a new array to hold the filtered array see if it makes any difference (I'm not sure why this would be a problem, but it's literally the only difference, so it's worth a try).

He is creating a new array. The allKeys lvar is storage for a pointer and it doesn't care what it points at.


To me is sounds like his [coloringEngine allKeys] is returning an array with something other then he expects or stringToComplete is nil or something other then he expects.

Brian use the debugger to understand what is going on. You can ask it to print out the description of each object to ensure it is as you expect.

-Shawn
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Predicate and beginswith
      • From: Brian Amerige <email@hidden>
References: 
 >Predicate and beginswith (From: Brian Amerige <email@hidden>)
 >Re: Predicate and beginswith (From: Joel Levin <email@hidden>)

  • Prev by Date: Re: NSPopUpButton Notifications
  • Next by Date: Re: NSPopUpButton Notifications
  • Previous by thread: Re: Predicate and beginswith
  • Next by thread: Re: Predicate and beginswith
  • Index(es):
    • Date
    • Thread