views:

36

answers:

1

I have an array which stores custom objects. Objects are of type Venue which have a property defined as name(which contains the names of venue).

Now I want to filter out objects with unique names.

This is how I was trying to do.

NSSet *uniqueVenuesSet = [NSSet setWithArray:[venueArray valueForKey:@"name"]];

NSMutableArray *uniqueVenues = [[NSMutableArray alloc] initWithArray:[uniqueVenuesSet allObjects]];

I get this error when I run this.

    -[NSCFString name]: unrecognized selector sent to instance 0x69a6190
2010-10-24 09:25:31.832 [75790:207]  Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString name]: unrecognized selector sent to instance 0x69a6190'

Can anyone give me a pointer on how to go about it.

+1  A: 

This is because there is at least one NSString object in venueArray.

Make sure that every element in your venueArray is of type Venue.

Jacob Relkin
no there are no strings in my array I've checked...
Asad Khan