Thread: search crashing
View Single Post
  #4 (permalink)  
Old April 4th, 2012, 08:08 AM
thepianoguy thepianoguy is offline
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default

Your difference is how you created your NSPredicate in the
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
method

the incorrect predicate is

Code:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name begins with[c] %@", self.searchBar.text];
and the correct one is
Code:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name beginswith[c] %@", self.searchBar.text];
There should not be a space between "begins" and "with".

Bob
The Following User Says Thank You to thepianoguy For This Useful Post:
Jule (April 4th, 2012)