CoreData: Find minimum of calculated property

后端 未结 1 476
时光取名叫无心
时光取名叫无心 2021-02-04 22:20

Say I have a CoreData entity \"Point\" with two properties x and y (both NSNumber).

How would a NSPredicate need to look like to let me find the closest Point to say a,b

1条回答
  •  悲&欢浪女
    2021-02-04 23:04

    Sorry, but doing arithmetic in an NSPredicate isn't supported. Only comparison operators can be used. And the news gets worse. You can't use a transient property in an NSFetchRequest. Only persistent properties can be used. If you really need this level of control in fetching your objects, Core Data may not be able to accommodate you.

    0 讨论(0)
提交回复
热议问题