iphone - crash on deleteRowsAtIndexPaths -


my application crashes when i'm deleting row table. here sources bug detected , stack trace. thanx!

//delete row database - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath {     nslog(@"\ncommiteditingstyle");      //delete user users table specified id     if(editingstyle == uitableviewcelleditingstyledelete)      {          //get object delete array.         [dbmanager open: @db_file_name];              //get userid array usersidlist[row] = userid!         nsnumber *usersid = [usersidlist objectatindex: [indexpath row]];         [dbmanager deleteuserwithid: [usersid intvalue] table: @table_users fieldname: @"userid" ];          [dbmanager close];          //delete object table.         [self.tableview deleterowsatindexpaths:          [nsarray arraywithobject: indexpath]          withrowanimation: uitableviewrowanimationfade];     } }  - (void)deleterowsatindexpaths:(nsarray *)indexpaths withrowanimation:(uitableviewrowanimation)animation {     nslog(@"\ndeleterowsatindexpaths"); }  [session started @ 2010-11-15 18:01:23 +0200.] 2010-11-15 18:01:25.052 phonebook[12397:207] ******* accessibility status changed: on 2010-11-15 18:01:25.101 phonebook[12397:207] ********** loading ax for: com.yourcompany.phonebook ************ 2010-11-15 18:01:30.060 phonebook[12397:207]  deletebtnuserclick 2010-11-15 18:01:31.878 phonebook[12397:207]  commiteditingstyle 2010-11-15 18:01:31.881 phonebook[12397:207] *** assertion failure in -[uitableview _endcellanimationswithcontext:], /sourcecache/uikit_sim/uikit-1262.60.3/uitableview.m:920 2010-11-15 18:01:31.883 phonebook[12397:207] *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of rows in section 0.  number of rows contained in existing section after update (6) must equal number of rows contained in section before update (6), plus or minus number of rows inserted or deleted section (0 inserted, 1 deleted).' *** call stack @ first throw: (     0   corefoundation                      0x02510b99 __exceptionpreprocess + 185     1   libobjc.a.dylib                     0x0266040e objc_exception_throw + 47     2   corefoundation                      0x024c9238 +[nsexception raise:format:arguments:] + 136     3   foundation                          0x000b8e37 -[nsassertionhandler handlefailureinmethod:object:file:linenumber:description:] + 116     4   uikit                               0x00338d37 -[uitableview(_uitableviewprivate) _endcellanimationswithcontext:] + 8719     5   uikit                               0x00328511 -[uitableview deleterowsatindexpaths:withrowanimation:] + 56     6   uikit                               0x0aaca8fc -[uitableviewaccessibility(accessibility) deleterowsatindexpaths:withrowanimation:] + 74     7   phonebook                           0x00003491 -[rootviewcontroller tableview:commiteditingstyle:forrowatindexpath:] + 392     8   uikit                               0x0032596d -[uitableview(uitableviewinternal) animatedeletionofrowwithcell:] + 101     9   uikit                               0x0aacde92 -[uitableviewcellaccessibility(safecategory) deleteconfirmationcontrolwasclicked:] + 62     10  uikit                               0x002be7f8 -[uiapplication sendaction:to:from:forevent:] + 119     11  uikit                               0x00349de0 -[uicontrol sendaction:to:forevent:] + 67     12  uikit                               0x0034c262 -[uicontrol(internal) _sendactionsforevents:withevent:] + 527     13  uikit                               0x0034ae0f -[uicontrol touchesended:withevent:] + 458     14  uikit                               0x002e23d0 -[uiwindow _sendtouchesforevent:] + 567     15  uikit                               0x002c3cb4 -[uiapplication sendevent:] + 447     16  uikit                               0x002c89bf _uiapplicationhandleevent + 7672     17  graphicsservices                    0x02d6c822 purpleeventcallback + 1550     18  corefoundation                      0x024f1ff4 __cfrunloop_is_calling_out_to_a_source1_perform_function__ + 52     19  corefoundation                      0x02452807 __cfrunloopdosource1 + 215     20  corefoundation                      0x0244fa93 __cfrunlooprun + 979     21  corefoundation                      0x0244f350 cfrunlooprunspecific + 208     22  corefoundation                      0x0244f271 cfrunloopruninmode + 97     23  graphicsservices                    0x02d6b00c gseventrunmodal + 217     24  graphicsservices                    0x02d6b0d1 gseventrun + 115     25  uikit                               0x002ccaf2 uiapplicationmain + 1160     26  phonebook                           0x000026ec main + 102     27  phonebook                           0x0000267d start + 53 ) terminate called after throwing instance of 'nsexception' 

i've seen before , have forgotten update source of data fill table. part of code missing. method caused is

  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return ; }  

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -