views:

687

answers:

2

Okay, I have an Book Object Class. That has Book.name and Book.id as extensions. Book.name being NSString. Which is what should be searchable and listed in UITableView.

NSMutableArray *matchingSymptomsArray = [[NSMutableArray alloc] initWithCapacity:50];

for(NSMutableArray *letterArray in DataArray){
     for(Book *bk in letterArray){ //Heres the ERROR
      NSLog(@"Uptil NEW");
      if([bk matchesSearchString:searchString]){
                        //I couldnt reach here, according to debugging and Logs//
       [matchingSymptomsArray addObject:bk];
      }
     }
    }

DataArray is where all the Books are held.. more than a hundred. Its the main datasource for the UITableView. I'm trying to search and match each letter of the string with the Book.name, but even before I can begin, I cant do the for(Book *bk in LetterArray) //producing the error..

What seems to be the problem?

This is the error in console ** -[Book countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x55c110 2009-09-29 06:17:41.073 Smart Diagnosis[3897:20b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[Book countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x55c110'*

Any work arounds??

thanks for your help :)

+1  A: 

Try this:

for (id bk in letterArray) { }

Did you check that letterArray isnt nil or empty?

ennuikiller
Nope, didnt work.
A: 

Did you check that letterArray isnt nil or empty?

ennuikiller
hmm, thats funny.. Its crashing if I'm calling for letterArray.count!for(NSMutableArray *letterArray in DataArray){ NSLog(@"dataarray = %d letterArray = %d", DataArray.count, letterArray.count); //It stops here.. DataArray is filled up fine, with 195 value. But When I add letterarray.count to it, it stops with the same error!.Im so confused!