• 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: NSTableView searching and predicates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView searching and predicates


  • Subject: Re: NSTableView searching and predicates
  • From: mmalc crawford <email@hidden>
  • Date: Sat, 4 Aug 2007 17:35:26 -0700


On Aug 4, 2007, at 4:44 PM, Andrew Farmer wrote:

NSPredicate *myFilterPredicate;
NSString *mySearchString = [sender stringValue];
if (mySearchString != nil)
{
myFilterPredicate = [NSPredicate predicateWithFormat:
@"%@ IN[cd] myEvent || %@ IN[cd] myNotes", mySearchString, mySearchString];
}
[self setFilterPredicate:myFilterPredicate];
[self rearrangeObjects];
}

That'll run [self setFilterPredicate:] on an uninitialized variable if mySearchString is nil. The third line should probably be:
NSPredicate *myFilterPredicate = [NSPredicate predicateWithValue:YES];
in order to get identical behavior to the original.


Mea culpa (the perils of typing code in Mail), I omitted the initialisation. It should, though, be:

	NSPredicate *myFilterPredicate = nil;

mmalc

_______________________________________________

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


References: 
 >NSTableView searching and predicates (From: Daniel Wambold <email@hidden>)
 >Re: NSTableView searching and predicates (From: mmalc crawford <email@hidden>)
 >Re: NSTableView searching and predicates (From: Andrew Farmer <email@hidden>)

  • Prev by Date: Associate, NSView in main window, and disable objects on panel
  • Next by Date: Re: performDragOperation for many types
  • Previous by thread: Re: NSTableView searching and predicates
  • Next by thread: Re: NSTableView searching and predicates
  • Index(es):
    • Date
    • Thread