I have a class of AddressCards.h/m
, and another class of AddressBook
,now I want to create a search method to look for names in the AddressBook class but getting some error.
I think I need my method to return an AddressCards type pointer but I'm not sure how to return it, since I need to have an array holding the names in case there is more than 1 match..
This is my current code:
-(NSMutableArray *) searchName:(NSString *) someName{
NSMutableArray *results = [NSMutableArray alloc];
for (NSString *name in book)
{
if ([someName caseInsensitiveCompare:name] == NSOrderedSame)
[results addObject:name];
}
return results;
}
@end
I'm getting error in this line: if ([someName caseInsensitiveCompare:name] == NSOrderedSame)
That says signal 1 SIGABRT
which I have no idea what is it :/
this is the method that adds addresscards:
-(void) addCard:(AddressCards *)theCard{
[book addObject:theCard];
}