View Full Version : My App Keep Getting Errors in IPhone 4.0 SDK

Jul 3, 2010, 11:45 AM
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

Jul 3, 2010, 05:15 PM
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.

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
myCell *cell = (myCell *)[tableView
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

Jul 4, 2010, 11:25 AM
Thanks for the Help CocoaBean but im still get a errors when i add the new code.

Jul 4, 2010, 01:44 PM
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.