Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

forcesteeler

macrumors 6502
Original poster
Oct 1, 2007
280
590
I Have a Application, It works fine in 3.0 but when i deploy it to IPhone 4.0 SDK i keep getting errors and i touch the Cells. It keeps saying Unknown Error

Heres the Pics and Source Code
 

Attachments

  • 1.png
    1.png
    93.2 KB · Views: 75
  • 2.png
    2.png
    59.8 KB · Views: 73
  • TopGamesViewController.pdf
    23.2 KB · Views: 82

CocoaBean

macrumors newbie
Feb 23, 2009
25
0
The answer should be very simple (from looking at the 2nd image).

The errors in the console suggest that you are implementing an old method which isn't used anymore (the accessorytypeAtIndexPath method).

That method was used to display an accessory on the table view cells.

What you now need to do is actually much simpler:

In the CellForRowAtIndexPath method, right before the (return cell; ) line - this is where you implement your chosen accessory type.

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
myCell *cell = (myCell *)[tableView
dequeueReusableCellWithIdentifier:kCellIdentifier2];
if (cell == nil) {
cell = [[[myCell alloc] initWithFrame:CGRectZero
reuseIdentifier:kCellIdentifier2] autorelease];
}
NSDictionary *gameItem = [gamesData objectAtIndex:indexPath.row];
cell.titleLabel.text = [gameItem objectForKey:@"game"];

//configure cell
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator //or whatever accessory type you need

return cell;
}

Also uncomment or delete the old accessoryTypeAtIndexPath: method
 

forcesteeler

macrumors 6502
Original poster
Oct 1, 2007
280
590
Thanks for the Help CocoaBean but im still get a errors when i add the new code.
 

Attachments

  • 1.png
    1.png
    56.1 KB · Views: 81

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Check the menu item Run > Stop On Objective C Exceptions in Xcode and then run your app.

When that out of bounds error occurs the app will stop in the debugger and you can see the line where you are making the faulty call to objectAtIndex.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.