检索记录我的 xcdatamodel 并过滤它们
retrieve record my xcdatamodel and filter them
抱歉我的英语不好,但我需要用我的第三个数据过滤我的 table(我在创建表格后添加了这个数据)。在我的日志中,我看到我的应用程序没有检索到 myThirdData,但是如果我记录了我的实体属性。也有 myThirdData。这是我的日志:
"(<NSAttributeDescription: 0x8dbc390>), name myFirstData, isOptional
1, isTransient 0, entity Targhe, renamingIdentifier dataIns,
validation predicates (\n), warnings (\n), versionHashModifier
(null)\n userInfo {\n \"com.apple.syncservices.Syncable\" = NO;\n},
attributeType 900 , attributeValueClassName NSDate, defaultValue
(null)",
"(<NSAttributeDescription: 0x8dbc280>), name mySecondData, isOptional 0, isTransient 0, entity Targhe, renamingIdentifier targa,
validation predicates (\n \"length <= 7\"\n), warnings (\n
1660\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700
, attributeValueClassName NSString, defaultValue (null)"
"(<NSAttributeDescription: 0x8dbc010>), name myThirdData, isOptional
0, isTransient 1, entity Targhe, renamingIdentifier utente, validation
predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo
{\n}, attributeType 700 , attributeValueClassName NSString,
defaultValue (null)" ) [...] 2015-01-06 09:56:40.211
myProject[581:60b] CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT,
t0.ZMYFIRSTDATA, t0.ZMYSECONDDATA FROM ZMYENTITY t0 WHERE t0.Z_PK IN
(?,?,?,?,?,?) ORDER BY t0.ZMYFIRSTDATA DESC LIMIT 20
添加谓词时出现错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath myThirdData not found in
entity <NSSQLEntity MyEntity id=1>'
这是我的谓词:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"myThirdData = %@", myThirdDataVar];
[fetchRequest setPredicate:predicate];
数据存储中不存在瞬态属性,因此您不能在 MOC 上的谓词 运行 中使用它们。您需要使属性成为非瞬态属性,或者您需要进行一次获取然后过滤结果(尽管在获取之后瞬态将全部为空)。
抱歉我的英语不好,但我需要用我的第三个数据过滤我的 table(我在创建表格后添加了这个数据)。在我的日志中,我看到我的应用程序没有检索到 myThirdData,但是如果我记录了我的实体属性。也有 myThirdData。这是我的日志:
"(<NSAttributeDescription: 0x8dbc390>), name myFirstData, isOptional
1, isTransient 0, entity Targhe, renamingIdentifier dataIns,
validation predicates (\n), warnings (\n), versionHashModifier
(null)\n userInfo {\n \"com.apple.syncservices.Syncable\" = NO;\n},
attributeType 900 , attributeValueClassName NSDate, defaultValue
(null)",
"(<NSAttributeDescription: 0x8dbc280>), name mySecondData, isOptional 0, isTransient 0, entity Targhe, renamingIdentifier targa,
validation predicates (\n \"length <= 7\"\n), warnings (\n
1660\n), versionHashModifier (null)\n userInfo {\n}, attributeType 700
, attributeValueClassName NSString, defaultValue (null)"
"(<NSAttributeDescription: 0x8dbc010>), name myThirdData, isOptional
0, isTransient 1, entity Targhe, renamingIdentifier utente, validation
predicates (\n), warnings (\n), versionHashModifier (null)\n userInfo
{\n}, attributeType 700 , attributeValueClassName NSString,
defaultValue (null)" ) [...] 2015-01-06 09:56:40.211
myProject[581:60b] CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT,
t0.ZMYFIRSTDATA, t0.ZMYSECONDDATA FROM ZMYENTITY t0 WHERE t0.Z_PK IN
(?,?,?,?,?,?) ORDER BY t0.ZMYFIRSTDATA DESC LIMIT 20
添加谓词时出现错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath myThirdData not found in
entity <NSSQLEntity MyEntity id=1>'
这是我的谓词:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"myThirdData = %@", myThirdDataVar];
[fetchRequest setPredicate:predicate];
数据存储中不存在瞬态属性,因此您不能在 MOC 上的谓词 运行 中使用它们。您需要使属性成为非瞬态属性,或者您需要进行一次获取然后过滤结果(尽管在获取之后瞬态将全部为空)。