myell0w/MTStatusBarOverlay

Error - History Insert

Closed this issue · 8 comments

Hello, I really liked your project, more to test the example shown in git an error occurs. iOS5

[self.historyTableView insertRowsAtIndexPaths: [NSArray arrayWithObject: newHistoryMessageIndexPath] withRowAnimation: UITableViewRowAnimationFade];

Assertion failure in -[_UITableViewUpdateSupport _computeRowUpdates], /SourceCache/UIKit_Sim/UIKit-
1912.3/UITableViewSupport.m:386

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid table view update. The application has requested an update to the table view that is inconsistent with the state provided by the data source.

Thank you.

Can you provide sample code what you did to get this error?
Are you on the latest commit?


cheers Matthias

Am 24.12.2011 um 13:27 schrieb Lucas Correa:

Hello, I really liked your project, more to test the example shown in git an error occurs. iOS5

[self.historyTableView insertRowsAtIndexPaths: [NSArray arrayWithObject: newHistoryMessageIndexPath] withRowAnimation: UITableViewRowAnimationFade];

Assertion failure in -[_UITableViewUpdateSupport _computeRowUpdates], /SourceCache/UIKit_Sim/UIKit-
1912.3/UITableViewSupport.m:386

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid table view update. The application has requested an update to the table view that is inconsistent with the state provided by the data source.

Thank you.


Reply to this email directly or view it on GitHub:
#41

I have integrated this nice class into my app but also faced with same issue and it came just using code given in ur description..

crash at this line
[self.historyTableView insertRowsAtIndexPaths: [NSArray arrayWithObject: newHistoryMessageIndexPath] withRowAnimation

Same here (on Simulator - iOS 4.2 ) (really nice lib!)

My source code is the same as the example provided

// same issue when use UIStatusBarStyleDefault , not issue when use UIStatusBarStyleBlackOpaque
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;

MTStatusBarOverlay *statusBar = [MTStatusBarOverlay sharedInstance];

[statusBar postMessage:@"11111111111111" animated:YES];
[statusBar postMessage:@"22222222222222" animated:YES];
[statusBar postMessage:@"33333333333333" animated:YES];
[statusBar postMessage:@"44444444444444" animated:YES];
[statusBar postMessage:@"55555555555555" animated:YES];

I have disabled history tableview to avoid the crash and it workded.

I think this crash by the messageHistory count error.

I changed the code as following:

  • (void)addMessageToHistory:(NSString *)message {
    //....

    if (self.historyEnabled) {
        NSIndexPath *newHistoryMessageIndexPath =
                [NSIndexPath indexPathForRow: (self.messageHistory.count - 1) //Here sub 1~~~
                                   inSection:0];
    

    [self setDetailViewHidden:self.detailViewHidden animated:YES];
    //....
    }

@myell0w do you mine that?

@biosli you were right, I slightly changed the logic of the history so the calculation wasn't right anymore, thanks for spotting!

thanks. guys.