我正在关注Xcode文档中的一个例子.我向模型添加了一个获取请求,并且通过Modeling GUI创建的谓词是:
firstname liKE[c] "*SUBSTRING*"
然后我用这两行检索该请求:
NSDictionary *substituionDictionary = [NSDictionary dictionaryWithObject:@"woody" forKey:@"SUBSTRING"];NSFetchRequest *fetchRequest = [mom fetchRequestFromTemplateWithname:@"firstnameContains" substitutionVariables:substituionDictionary];
生成的NSFetchRequest的NSLog输出:
(entity: Customer; predicate: (firstname liKE[c] "*SUBSTRING*"); sortDescriptors: (null); limit: 0)
..表示在返回存储的FetchRequest之前未替换变量.
那么,如何指定在Xcode数据建模获取请求谓词生成器GUI中输入的文本将在运行时由NSFetchRequest替换:fetchRequestFromTemplateWithname:substitutionVariables 总结
以上是内存溢出为你收集整理的cocoa – 存储在CoreData模型中的FetchRequests的变量替换全部内容,希望文章能够帮你解决cocoa – 存储在CoreData模型中的FetchRequests的变量替换所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)