iOS中使用谓词的小写模型对象
在这段代码中,我希望eventName键是小写的,以便匹配,上面的代码将eventNameArray对象设置为小写iOS中使用谓词的小写模型对象,ios,objective-c,core-data,nspredicate,Ios,Objective C,Core Data,Nspredicate,在这段代码中,我希望eventName键是小写的,以便匹配,上面的代码将eventNameArray对象设置为小写 NSPredicate *predicate = [NSPredicate predicateWithFormat:@"eventName In[c] %@", eventNameArray]; eventName是我的核心数据模型中的一个对象,我希望它是小写的 NSPredicate *predicate = [NSPredicate predicateWi
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"eventName In[c] %@", eventNameArray];
eventName是我的核心数据模型中的一个对象,我希望它是小写的
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"eventName In[c] %@", eventNameArray];
这可以正常工作,但不适用于模型对象。您可以使用
小写:()
函数将属性强制为小写:
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]);
多谢了,男人,挣扎了几天,尝试了不同的组合。我不知道这件事。