NSDictionaryResultType expression not taking into account newly inserted objects

跟風遠走 提交于 2019-11-29 10:55:44

I've had a response from the Apple Developer Forums and it was confirmed that it doesn't take into account unsaved changes.

This behaviour is documented (poorly) in [NSFetchRequest setIncludePendingChanges:]. A value of YES is not supported with NSDictionaryResultType. This means that you cannot use NSExpressionDescription on unsaved changes.

FYI, you can skip the whole NSExpression section and just go ahead with the fetch, then use collection operators for the max value.

theID = [objects valueForKeyPath:"@max.myNumbericID"];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!