Monday, November 9, 2009

NSFetchedResultsController

I have been fighting with NSFetchedResultsController. After some struggles, I think I have finally made peace with it.

If you want to save yourself some hassle, replace your current Navigation-Based Core Data Application Xcode project with this one. Unzip and copy the folder to this location, replacing the one that's there:

/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application/Navigation-based Application/



6 comments:

Dallas said...

Jeff, would it be possible for you to comment on what you changed and why?

sgaw said...

One small point... On iPhone OS 3.0, if you have a single section table view there is a problem with the numberOfSectionsInTableView: method.

Apple's suggested solution is:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
NSUInteger count = [[<#Fetched results controller#> sections] count];
if (count == 0) {
count = 1;
}
return count;
}

Jeff LaMarche said...

Dallas:

I implemented the various NSFetchedResultsController delegate methods to handle properly updating the table based on the action taken. Mostly code borrowed from Core Data Books.

Simon:

Yeah, you're right. I missed that. I use that in my own project, but forgot it when I did the template. I'll update it and repost. Thanks.

Edwin said...

scrub m65 kamagra attorney lawyer body scrub field jacket lovegra marijuana attorney injury lawyer

SEO Services Consultants said...

Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck! Web Design Company

h4ns said...

What youre saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I also love the images you put in here. They fit so well with what youre trying to say. Im sure youll reach so many people with what youve got to say.

Arsenal vs Huddersfield Town live streaming
Arsenal vs Huddersfield Town live streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Wolverhampton Wanderers vs Stoke City Live Streaming
Notts County vs Manchester City Live Streaming
Notts County vs Manchester City Live Streaming
Bologna vs AS Roma Live Streaming
Bologna vs AS Roma Live Streaming
Juventus vs Udinese Live Streaming
Juventus vs Udinese Live Streaming
Napoli vs Sampdoria Live Streaming
Napoli vs Sampdoria Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
Fulham vs Tottenham Hotspur Live Streaming
AS Monaco vs Marseille Live Streaming
AS Monaco vs Marseille Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Alajuelense vs Perez Zeledon Live Streaming
Technology News | News Today | Live Streaming TV Channels