I’m developing an app that uses Core Data for save and retrieve data.
Now I would like to add a badge number on app’s icon in the home screen but I have some problems…
I tried this code:
NSInteger section = [self.tableView numberOfSections];
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:[sectionInfo numberOfObjects];
This code don’t work but I don’t know how to do this…
What code I must write and where? Inside AppDelegate or RootViewController? And in which method?
Thanks all for the help!
That’s not a valid section number; they go from 0 to numberOfSections-1.