Does my code look right? Im trying to load data into my table view and detailed sub view. My table works fine, but the data wont load in my sub view
The warning appears under this line
nextController.dataItem = [data objectAtIndex:indexPath];
Here is my RootViewController.m
// Configure the data for the cell.
NSDictionary *dataItem = [data objectAtIndex:indexPath.row];
cell.icon = [UIImage imageNamed:[dataItem objectForKey:@"Icon"]];
cell.publisher = [dataItem objectForKey:@"Publisher"];
cell.name = [dataItem objectForKey:@"Name"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NextViewController *nextController = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil];
nextController.dataItem = [data objectAtIndex:indexPath];
[self.navigationController pushViewController:nextController animated:YES];
[nextController release];
}
and my nextviewcontroller.h
#import <UIKit/UIKit.h>
@interface NextViewController : UIViewController
{
UILabel *nameLabel;
UIImageView *iconView;
NSDictionary *dataItem;
}
@property (nonatomic, retain) IBOutlet UILabel *nameLabel;
@property (nonatomic, retain) IBOutlet UIImageView *iconView;
@property (nonatomic, retain) NSDictionary *dataItem;
@end
It loads but I get the following warning.
"warning: passing argument 1 of 'objectAtIndex:' makes integer from pointer without a cast
The debugger says
Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (64244544) beyond bounds (50)'
Any Ideas? thanks