MessageDisplayKit icon indicating copy to clipboard operation
MessageDisplayKit copied to clipboard

这一段会crash,当数据很快被插入的时候

Open alexliubj opened this issue 9 years ago • 4 comments

// WEAKSELF // [self exChangeMessageDataSourceQueue:^{ // NSMutableArray *messages = [NSMutableArray arrayWithArray:weakSelf.messages]; // [messages addObject:addedMessage]; //
// [weakSelf exMainQueue:^{ // weakSelf.messages = messages; //
// NSMutableArray *indexPaths = [NSMutableArray arrayWithCapacity:1]; // [indexPaths addObject:[NSIndexPath indexPathForRow:weakSelf.messages.count - 1 inSection:0]]; // [weakSelf.messageTableView beginUpdates]; // [weakSelf.messageTableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; // [weakSelf.messageTableView endUpdates]; // // [weakSelf scrollToBottomAnimated:YES]; // }]; // }];

alexliubj avatar Dec 22 '15 02:12 alexliubj

XHMessageTableViewController.m

alexliubj avatar Dec 22 '15 02:12 alexliubj

[weakSelf.messageTableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];

更换成 [weakSelf.messageTableView reloadData]

sanshanchuns avatar Feb 02 '16 03:02 sanshanchuns

+1,遇到了相同的问题,害惨我了。。他这个插入消息的方法写的有很大问题。滥用GCD啊! 千万不要用他的addMessage方法,自己写一个: 要在主线程执行

XHMessage *xhMessage = [self getXHMessageByMsg:message];
[self.messages addObject:xhMessage];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:self.messages.count -1 inSection:0];
[self.messageTableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
[self scrollToBottomAnimated:YES];

bitnpc avatar Aug 18 '16 02:08 bitnpc

@bitnpc I am also facing same issue . Please help me how to add own method to add method screen shot 2016-09-30 at 4 03 20 pm screen shot 2016-09-30 at 4 03 20 pm

mssiosteam avatar Oct 01 '16 12:10 mssiosteam