Reputation: 490
As CoreData length is not supported and CoreData translates the predicate name.length > 1 to sqlite in name > 1... While it should be length(name) > 1.
We can use this one: [NSPredicate predicateWithFormat:@"NOT name MATCHES '^\s*$'"];
But regular expression will have a higher computation cost (takes longer than to evaluate a regex than simple equality).
SO how i have to do fetch.Any best idea ?
Upvotes: 0
Views: 1669
Reputation: 258
Please go through CoreData predicate: string property length?
or you can do like this
NSString *attributeName = @"name";
NSString *attributeValue = [NSString stringWithFormat:@".{%d}", 5];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K MATCHES %@", attributeName, attributeValue];
Reference - NSPredicate for an NSManagedObject's string attribute's length
Upvotes: 2