U_ILLEGAL_ARGUMENT_ERROR崩溃了我的应用程序

时间:2012-10-28 22:30:13

标签: iphone ios nsdictionary didselectrowatindexpath

当我从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个这样的词典。 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

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

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"MASTER CONTAINS [c]%@", cell.textLabel.text];
filterDataArray = [dataArrayOfDictionaries filteredArrayUsingPredicate:predicate];
相关问题