获取核心数据实体中的记录数 [英] Getting a count of records in a core data entity

查看:73
本文介绍了获取核心数据实体中的记录数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道现有功能或属性可以提供我在文档中缺少的核心数据实体中的记录计数吗?

Anyone know of an existing function or property that provides a count of the records in a core data entity that I'm missing in the docs?

任何帮助表示赞赏
谢谢//:)

Any help appreciated Thanks // :)

推荐答案

我相信实现此目标的最佳方法是通过NSManagedObjectContext的 countForFetchRequest:error:

I believe the best way to accomplish this is through NSManagedObjectContext's countForFetchRequest:error:

它的工作原理与常规提取请求相同,只是它只返回计数,因此可能会进行优化。

It works just like a regular fetch request, except that it only returns the count and presumably could therefore be more optimized.

这篇关于获取核心数据实体中的记录数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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