В моем табличном представлении ничего не отображается (хотя данные есть), и когда я переключаюсь на него из панели вкладок, я получаю сообщение об ошибке:
2011-06-28 11: 25: 20.043 Папарацци [7773: 207] - [__ NSCFArray секции]: нераспознанный селектор отправлен в экземпляр 0x592d2d0
2011-06-28 11: 25: 20.048 Папарацци [7773: 207] * Завершение приложения из-за необработанного исключения «NSInvalidArgumentException», причина: '- [__ NSCFArray section]: нераспознанный селектор, отправленный экземпляру 0x592d2d0'
Что я делаю не так?
Полный код вы можете получить по адресу:
https://github.com/blasto333/Paparazzi
Заголовок
@interface PersonListViewController : UITableViewController {
NSFetchedResultsController *fetchResultsController;
}
@end
Осуществление
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
fetchResultsController = [[FlickrFetcher sharedInstance] fetchedResultsControllerForEntity:@"Person" withPredicate:nil];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return [[fetchResultsController sections] count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
id <NSFetchedResultsSectionInfo> sectionInfo = [[fetchResultsController sections] objectAtIndex:section];
return [sectionInfo numberOfObjects];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
Person *person = [fetchResultsController objectAtIndexPath:indexPath];
[cell.textLabel setText:person.name];
return cell;
}