gpt4 book ai didi

objective-c - fetchRequestFromTemplateWithName 返回 nil

转载 作者:行者123 更新时间:2023-11-28 22:58:31 25 4
gpt4 key购买 nike

enter image description here

我添加了 FETCH REQUESTS 并编写了以下代码。

NSFetchRequest *fetchRequest = [delegate.managedObjectModel 
fetchRequestFromTemplateWithName:@"isUser"
substitutionVariables:nil];

但是 fetchRequest 返回 nil。帮帮我!

最佳答案

来自fetchRequestFromTemplateWithName: 的文档:

The variables dictionary must provide values for all the variables. If you want to test for a nil value, use [NSNull null].

NSFetchRequest *fetchRequest = [delegate.managedObjectModel 
fetchRequestFromTemplateWithName:@"isUser"
substitutionVariables:[NSDictionary dictionaryWithObjectsAndKeys:
@"type", [NSNull null], nil]];

也许您正在寻找无需替换变量即可工作的 fetchRequestTemplateForName:

关于objective-c - fetchRequestFromTemplateWithName 返回 nil,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10363971/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com