iphone - U_ILLEGAL_ARGUMENT_ERROR 导致我的应用程序崩溃

标签 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 个这样的字典。 任何帮助将不胜感激。

最佳答案

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

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/

相关文章:

objective-c - 向 NSDictionary 添加负 NSNumber 值

iphone - 自定义相机旋转问题

iphone - 无效的二进制文件,收到电子邮件

ios - 当应用程序关闭时,在内存中保留一个 Firebase 监听器

iphone - iOS设计PNG文件

ios - 向 SKSpriteNode 施加脉冲以赋予其随机方向

swift - 如何将值与 NSdictionary 的相似键合并

ios - NSJSONSerialization 产生垃圾

iphone - 如何确定 iPhone 晃动的方向

iphone - 从 self.navigationItem(在 UINavigationController 内部)打开时,UIPopoverController 未解除