我正在尝试创建一个获取请求,而不是在代码中,而是通过使用核心数据模型编辑器来获取所有对日期属性没有值的 Book 对象。
我尝试了各种方法来指定这一点。一个例子如...
...但是,当我离开并返回数据模型编辑器时,Xcode 已将其更改为今天的日期...
如果这只是模型编辑器的限制,而在代码中进行是唯一的方法,那就这样吧。我只是想保持一致,因为我的所有其他获取请求都已在模型编辑器中完成,并且没有定义问题。
Aaah, this is almost a philosophical issue. nil
is simply not a valid date, so it should not be in the predicate. There is a simple workaround, though:
Initialize your date to some extreme value, and check for that value (or if the date is beyond that value).
I also noticed that perhaps in the editor it is just a display thing. If you toggle the switch in the upper right corner (Editor/Expression view I guess) you will see that the query has not changed, even if in one view today's date is displayed.
Therefore it might just work anyway. In this case it is just a display bug.