UISearchDisplay - application crash
i've got huge problem. I've copied some code from table search sample from Apple Resource pages.
here's the case:
#pragma mark -
#pragma mark Content Filtering
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
[self.chatMessagesArrayCopyForSearching removeAllObjects]; // First clear the filtered array.
if ([searchText length]==0)
{
}else
{
for (FriendMessage *friend in chatMessagesArray)
{
NSComparisonResult result = [friend.message compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
if (result == NSOrderedSame)
{
[self.chatMessagesArrayCopyForSearching addObject:friend];
NSLog(@"%@", friend.message);
}
}
}
}
application crash when for example i type one letter, and then the second letter. probably there something with friend.message becouse console says:
-[AccessibilityObjectWrapper message]: unrecognized selector sent to instance 0x5d8d580
FriendMessage is custom class, inherited from NSObject, a开发者_Go百科nd message is standard NSString *.
thanks for any provided help
mapedd
p.s. sorry if code isn't very readable
The fact that it says 'AccessibilityObjectWrapper' in your error tells you that there might have been a FriendMessage object there at some point but it's gone now :)
This is typically because there is a missing retain somewhere in your code.
Where do you create the array of FriendMessage objects - can you edit your question and add that code as well?
Thanks.
精彩评论