【发布时间】:2020-07-15 06:47:43
【问题描述】:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"eventName In[c] %@", eventNameArray];
在此代码中,我希望 eventName 键为小写以进行匹配,上面的代码将 eventNameArray 对象设为小写。
eventName 是我的核心数据模型中的对象之一,我想将其小写。
NSArray *dbArray = [[NSArray alloc] initWithObjects:@"Add To Cart",@"Add To Cart",@"Lead Submitted",@"Add To Cart",@"Product Purchase", nil];
NSArray *eventArray = [[NSArray alloc] initWithObjects:@"add to cart",@"lead submitted", nil];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self IN[c] %@", eventArray];
NSLog(@"%@",[dbArray filteredArrayUsingPredicate:predicate]);
这工作正常,但不适用于模型对象。
【问题讨论】:
标签: ios objective-c core-data nspredicate