作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
当将 NSFetchRequest 结果类型设置为 NSDictinaryResultType 时,将返回零个对象。如果我删除 setPropertiesToFetch 和 setResultType,将返回所有对象。
有什么想法吗?
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Alert" inManagedObjectContext:_managedObjectContext];
[request setEntity:entity];
NSDictionary *entityProperties = [entity propertiesByName];
[request setPropertiesToFetch:[NSArray arrayWithObject:[entityProperties objectForKey:@"test"]]];
[request setResultType:NSDictionaryResultType];
NSError *error;
NSArray *result = [_managedObjectContext executeFetchRequest:request error:&error];
if (result == nil) {
NSLog(@"Error: %@", [error localizedDescription]);
}
最佳答案
问题是我需要在插入新对象后保存 managedObjectContext。一旦我这样做了,我就得到了我正在寻找的结果。
关于ios - 核心数据 NSFetchRequest setResultType :NSDictionaryResultType not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7019422/
当将 NSFetchRequest 结果类型设置为 NSDictinaryResultType 时,将返回零个对象。如果我删除 setPropertiesToFetch 和 setResultType
本文整理了Java中net.sf.saxon.query.XQueryFunction.setResultType()方法的一些代码示例,展示了XQueryFunction.setResultType
我是一名优秀的程序员,十分优秀!