Ios5 ios中带有表视图的搜索栏

Ios5 ios中带有表视图的搜索栏,ios5,nspredicate,Ios5,Nspredicate,我在预测中遇到错误 "*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "title tcontains[cd] %@"' *** First throw call stack: (0x15d6012 0x13fbe7e 0xe14355 0xe14173 0xe14127 0x5b68 0x5deb 0x62

我在预测中遇到错误

"*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "title tcontains[cd] %@"'
*** First throw call stack:
(0x15d6012 0x13fbe7e 0xe14355 0xe14173 0xe14127 0x5b68 0x5deb 0x626ff3 0x576c86 0x140f705 0x343213 0x404c7e 0x404310 0x41113c 0x41b5a6 0xebc4f9 0x16300c5 0x158aefa 0xdf0bb2 0x406e9de 0x31bc1da 0x35f5dfc 0x35f8bf8 0x4049612 0x404974a 0x4049ec0 0x4049cb8 0x4049204 0x343722b 0x3437193 0x401be96 0x40484cc 0x35f3136 0x35f23c6 0x3625980 0x3c817fd 0x361c576 0x361d6da 0x361b72e 0x3c7feaa 0x3635af1 0x362572a 0x35f96ae 0x31f862b 0x140f6b0 0x4064810 0x32371a4 0x32392ff 0x5010b4 0x4c3aef 0x4c4e58 0x4c39fe 0x4cdd29 0x350ddb 0x44e7f5 0x44e7f5 0x44e7f5 0x44e7f5 0x44e7f5 0x44e7f5 0x44e7f5 0x44e7f5 0x44e7f5 0x44e7f5 0x350e35 0x350806 0x350beb 0x342698 0x22fcdf9 0x22fcad0 0x154bbf5 0x154b962 0x157cbb6 0x157bf44 0x157be1b 0x22fb7e3 0x22fb668 0x33fffc 0x201d 0x1f45)
libc++abi.dylib: terminate called throwing an exception"
请帮帮我

这是我的密码

- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{

    [searchResults removeAllObjects];

    NSString *str1 = [searchText stringByReplacingOccurrencesOfString:@"\"" withString:@""];
    NSLog(@"data_arra==>%@",arr_search);
    NSLog(@"searchText==>%@",searchText);

    NSPredicate *resultPredicate = [NSPredicate
                                    predicateWithFormat:@"title tcontains[cd] %@",
                                    str1];
    NSLog(@"result==>%@",resultPredicate);

    searchResults = [NSMutableArray arrayWithArray:[arr_search filteredArrayUsingPredicate:resultPredicate]];
}


array value for arr_search 

arr_search ==>(
    "Phoenix Market City",
    "Express Avenue",
    "Ampa Skywalk",
    "The Forum Vijaya Mall",
    "Chennai Citi Centre",
    "Spencer Plaza",
    "Chandra Metro Mall",
    "The Grand Mall",
    "Ramee Mall",
    "Alsa Mall",
    "Prince Plaza",
    "Ispahani Centre",
    "Fountain Plaza",
    Lifestyle,
    "Grand Venus Spectrum Mall",
    "Raahat Palaza",
    "Patni Plaza",
    "Maya Plaza",
    "Phoenix Mall, Chennai",
    Megamart,
    "Phoenix marketcity",
    Aldo,
    "Gokul Arcade",
    "Parsn Complex",
    "Spectrum mall",
    "Express Avenue Chambers",
    "Big Bazaar",
    "Spencer's",
    "Saravana Stores",
    "CEX (complete entertainment exchange)"
)

我认为这是打字错误

NSPredicate *resultPredicate = [NSPredicate
                                    predicateWithFormat:@"title tcontains[cd] %@",
                                    str1];
应该是

NSPredicate *resultPredicate = [NSPredicate
                                    predicateWithFormat:@"title contains[cd] %@",
                                    str1];

谢谢你的回复,朋友。现在我在表视图中得到了但没有加载样本数组。您是说您在这方面仍然有问题,还是现在工作正常?-(void)filterContentForSearchText:(NSString*)searchText范围:(NSString*)范围{//NSLog()NSPredicate*resultPredicate=[NSPredicate predicateWithFormat:@“SELF contains[cd]%@,searchText];arr1=[arr_search filteredarrayingpredicate:resultPredicate];NSLog(@“value=>%@”,arr1);}因为arr1得到了搜索值,但没有加载到tableview@simIf您在那里得到了正确的数组。然后,您所要做的就是保留数组,然后重新加载tableview。