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

NSPredicate predicateWithFormat:


  • Subject: NSPredicate predicateWithFormat:
  • From: chaitanya pandit <email@hidden>
  • Date: Thu, 23 Oct 2008 22:35:01 +0530

Hi list,
I have an array controller that manages certain entities, each of the entity has an attribute "Name" now i want to search for entities with names from a given array,
Say i have an array (namesArray) with contents "Tom, Matt, Joe" now what i do is, i create a predicate which will look for the names in the given array within all the entities present in the array controller,


NSArray *namesArray = [NSArray arrayWithObjects:@"Tom" , @"Matt" , @"Joe", nil];
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"Name IN %@", namesArray];
NSMutableArray *foundNames = [[arrayController arrangedObjects]filteredArrayUsingPredicate:predicate];


It works but he problem is that i have a memory leak over here, before creating the predicate, the retain count of namesArray is 1, but after i create the predicate it is 2
and in instruments i see a memory leak with the namesArray.


Any idea what i'm doing wrong?
Thanks
Chaitanya
_______________________________________________

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: NSPredicate predicateWithFormat:
      • From: Keary Suska <email@hidden>
  • Prev by Date: NSPredicate predicateWithFormat:
  • Next by Date: Re: BonjourSample from Hillegass (Advanced Mac OS X Programming)
  • Previous by thread: NSPredicate predicateWithFormat:
  • Next by thread: Re: NSPredicate predicateWithFormat:
  • Index(es):
    • Date
    • Thread