I’m having some problems with a couple lines of code that are causing my iPhone app to not build. It’s part of a lesson in BNR’s new “Objective-C Programming” book. Since it just came out on Kindle (isn’t even in print yet), there’s no addendums or corrections yet.
I’m guessing I have some syntax wrong — if there’s any more code before or after I need to add let me know.
Thanks!
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
// Because this table view only has one section,
// the number of rows in it is equal to the number
// of items in our tasks array
return [tasks count];
}
edit: people are asking for some more code so I’m going to add it to pastebin — I don’t want to spam the page here. Here’s the header file, here’s the method file.
The tableView dataSource methods needs to be in the
@implementationblock (.m file), not@interface(.h file). Just cut the code from .h and move it to .m file and it should be fine.