Menu
  • HOME
  • TAGS

NSExpression using sqrt: function results in NSInvalidArgumentException

ios,core-data,nsfetchrequest,nsexpression,nsexpressiondescription

Not every expression that's valid for NSExpression is valid for use when fetching from Core Data when using a SQLite store. Unfortunately sqrt: is not supported for this kind of use. It would probably work with a binary store, but that loses many of the advantages of Core Data (it...

Is it possible to use a group by count in the havingPredicate for a CoreData fetch (for dupe detection)?

ios,core-data,nsexpression

Best I can come up with is: NSError* error; NSManagedObjectContext* context = self.managedObjectContext; NSEntityDescription* entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:context]; // Construct a count group field NSExpressionDescription* count = [NSExpressionDescription new]; count.name = @"count"; count.expression = [NSExpression expressionWithFormat:@"count:(value)"]; count.expressionResultType = NSInteger64AttributeType; // Get list of all "value" fields (only) NSPropertyDescription* value...