这是我从 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 个这样的字典。 任何帮助将不胜感激。
最佳答案
我认为在这种情况下您没有正确使用谓词,请尝试这个
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"MASTER CONTAINS [c]%@", cell.textLabel.text];
filterDataArray = [dataArrayOfDictionaries filteredArrayUsingPredicate:predicate];
关于iphone - U_ILLEGAL_ARGUMENT_ERROR 导致我的应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13113651/