views:

120

answers:

2

Hey, I want to set up my app as a free version and unlock it with in app purchases, just so I'll get more exposure. The free version should be limited and therein lies my problem.

My app uses core data heavily and to make the free version, I just want to limit all records displayed to 1 row in each tableview, or if anybody else has any better ideas, those'd work too.

I've been trying to set my numberOfRowsInSection to return 1, but everytime I add something I get a range exception as I'm using a fetchedResultsController. Any ideas?

Here's my section and row code:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [[fetchedResultsController sections] count];}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

id <NSFetchedResultsSectionInfo> sectionInfo = [[fetchedResultsController sections] objectAtIndex:section];
return [sectionInfo numberOfObjects];}
A: 

You could handle this in your didSelectRow method. If the row isn't 0, throw an UIAlertView that explains how you can buy the app to use the full version. This will also show users that more content exists. I seem to recall Apple not liking advertisements for full versions, but I've also seen plenty of it, so I guess it's OK now.

David Kanarek
+2  A: 

Use -setFetchLimit: on the NSFetchRequest. If you set it to 1 then the NSFetchResultController will only give you a single row back.

Marcus S. Zarra