, истекающего приложение из-за неперехваченное исключение» NSUnknownKeyException « причины:» [< __NSCFString 0x9c7aaf0> valueForUndefinedKey]: этот класс не значение ключа кодирования совместимый для имени ключаНагрузочного приложение из-за неперехваченное исключение «NSUnknownKeyException», причина: «этот класс не является значение ключа кодирования совместимым для имени ключа
Я искал всю StackOverflow с этой ошибкой, но я вмятина найти решение я думаю, у меня есть другая проблема.
Я пытаюсь реализовать UISearchDisplayController в моем проекте у меня есть UITableView отображения некоторый контент из базы данных SQLite и после показа я хочу искать с тем, что я хочу, но я не в состоянии сделать это, пожалуйста, кто-нибудь помощь
Здесь мой код:
-(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
NSPredicate *resultPredicate = [NSPredicate predicateWithFormat:@"name contains[c] %@", searchText];
searchResults = [jobTitleArray filteredArrayUsingPredicate:resultPredicate];`
}
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
[self filterContentForSearchText:searchString scope:
[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
return YES;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//int rowCount;
if (tableView == self.searchDisplayController.searchResultsTableView)
{
NSLog(@"Search count %d",[searchResults count]);
return [searchResults count];
} else
{
NSLog(@"jobTitleArray Search count %d",[jobTitleArray count]);
return [jobTitleArray count];
}
//return rowCount;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
JobDetailViewController *jobD = [[JobDetailViewController alloc] init];`
NSLog(@"Before: %@", jobD);
if (tableView == self.searchDisplayController.searchResultsTableView) {
[self performSegueWithIdentifier: @"showJobDetail" sender: self];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath`
{
static NSString *CellIdentifier = @"Cell";
//jobTableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
jobTableCell *cell = (jobTableCell *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];`
if (cell == nil) {
cell = [[jobTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
JobDone *jobD = nil;
if (tableView == self.searchDisplayController.searchResultsTableView) {
NSLog(@"job %@",searchResults);
jobD = [searchResults objectAtIndex:indexPath.row];
} else
{
jobD = [jobTitleArray objectAtIndex:indexPath.row];
}
cell.companyLabel.text=[companyArray objectAtIndex:indexPath.row];
cell.titleLabel.text = [jobTitleArray objectAtIndex:indexPath.row];
cell.descLabel.text=[descArray objectAtIndex:indexPath.row];
return cell;
}
@end
Итак, где он падает? Это [self performSegueWithIdentifier: @ "showJobDetail" отправитель: self]? – James
его сбой после filterContentForSearchText. – Nagarjun