views:

58

answers:

2

Hi, 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, and message is standard NSString *.

thanks for any provided help

mapedd

p.s. sorry if code isn't very readable

A: 

hi,

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.

deanWombourne
A: 

Hi I'm creating my chatMessageArray i.e. container for my my FriendMessages objects in viewDidLoad, its a class variable, and i don't releasing it in code. chatMessageArray if filled by some XML from internet, at first it displays everything correctly, but after searching it crashes., For example, i've got a message which beggins like: "0Suspendise ...", when i type "0", searchdisplaycontroller shows this message, but, after typing "S" it crashes.

Mapedd