我可以设置瞬态属性来获取吗? [英] Can I set transient properties to fetch?

查看:56
本文介绍了我可以设置瞬态属性来获取吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建 NSFetchRequest 并将属性设置为如下所示:

I want to create NSFetchRequest and set properties to fetch like this:

request.propertiesToFetch = @[@"a", @"b", @"c"];

其中 a b 存储在Core Data数据库中,而 c 是瞬态的. executeFetchRequest:会引发错误传递给setPropertiesToFetch:的无效密钥路径c.但是,如果我取消选中属性 c 的transient-checkbox,一切都会正常进行.那么获取临时属性真的是不可能的,还是我做错了什么?

where a and b are stored in Core Data database, and c is transient. executeFetchRequest: fires an error Invalid keypath c passed to setPropertiesToFetch:. But if I uncheck transient-checkbox for property c everything will work fine. So is it really impossible to fetch transient properties or I'm doing something wrong?

推荐答案

是的,这确实是不可能的.您无法获取它们,因为它们在持久性存储中不存在-这就是暂时的含义.您可以获取从其创建派生的瞬时属性的任何持久属性.

Yes, it is really impossible. You can't fetch them because they don't exist in the persistent store - that's what it means to be transient. You can fetch whatever persistent attributes the derived, transient, attribute is created from.

这篇关于我可以设置瞬态属性来获取吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆