I recently have just been able to populate my core data DB. I have an attribute named username and I would like to get the total number of users on the system (in the DB) and print it out. I know I need to use NSFetchRequest along with NSEntityDescription. I am just not sure how to go about it. I haven’t really seen a question like this on SO. The entity is named Account and my attribute is labeled username
Share
For your particular case, I suppose you have each username as a separate record so you can use the
-countForFetchRequest:error:method ofNSManagedObjectContextto get the number of objects a given fetch request would have returned if it had been passed toexecuteFetchRequest:error: