0

这是我从 UITableView 中选择一个值时收到的错误

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't do regex matching, reason: Can't open pattern U_ILLEGAL_ARGUMENT_ERROR (string Motron, pattern 
libc++abi.dylib: terminate called throwing an exception
(lldb) 

这是我第一次遇到这样的错误。我在下面显示的第二行代码的tableview 方法didSelectRowAtIndexPath中收到它

// This predicate restricts the filterDataArray to the related values of the selected index
            NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K like %@",@"MASTER",cell.textLabel.text];
            filterDataArray = [dataArrayOfDictionaries filteredArrayUsingPredicate:predicate];

我已经注销了字典数组,这就是其中一个字典值的样子。

{
        HASM = 1;
        ISM = 0;
        ISV = 0;
        MASTER = Merc;
        MANURE = 96;
    }

数组中大约有 60 或 17 个这样的字典。任何帮助将不胜感激。

4

1 回答 1

1

我认为在这种情况下你没有正确使用谓词,试试这个

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"MASTER CONTAINS [c]%@", cell.textLabel.text];
filterDataArray = [dataArrayOfDictionaries filteredArrayUsingPredicate:predicate];
于 2012-10-28T23:07:03.700 回答