Sunday, 24 April 2011

SIGABRT and Setting Cells


hello.

have uitableview , 3 arrays.

1 section 1, next section 2, last carries both arrays.

when add value first array error sigabrt.

code:
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section  {      // return number of rows in section.            if(section == 0) {          return [array1 count];      }      if(section == 1) {          return [array2 count];      }  }    - (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];      }  [u][b]//sigabrt happens on line below[/b][/u]      cell.textlabel.text = [nsstring stringwithformat:@"%@",[[botharrays objectatindex:indexpath.section] objectatindex:indexpath.row]];      cell.backgroundcolor = [uicolor colorwithwhite:100 alpha:.65f];            return cell;  }  
ps: book learn objective-c?

thanks!
 

you sigabrt error because nice developers @ apple want send message there bug in code. decided have made programmer error. nice print out explanation in debugger console details.

should in debugger console message you.

errors arrays in code show caused out of range errors. you've asked objectatindex: index past end of array. recommend change code each of objectatindex calls in own expression, is, each 1 on own line of code. figure out 1 failing.
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment