My App Keep Getting Errors in IPhone 4.0 SDK

Discussion in 'iOS Programming' started by forcesteeler, Jul 3, 2010.

  1. macrumors 6502

    Joined:
    Oct 1, 2007
    #1
    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
     

    Attached Files:

  2. macrumors newbie

    Joined:
    Feb 23, 2009
    #2
    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
     
  3. thread starter macrumors 6502

    Joined:
    Oct 1, 2007
    #3
    Thanks for the Help CocoaBean but im still get a errors when i add the new code.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      56.1 KB
      Views:
      17
  4. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    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.
     

Share This Page