mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Improve logging of conversation view exceptions.
This commit is contained in:
parent
84bda352ed
commit
b3c19b7905
|
@ -3468,28 +3468,40 @@ typedef enum : NSUInteger {
|
|||
}
|
||||
};
|
||||
|
||||
if (shouldAnimateUpdates) {
|
||||
[self.collectionView performBatchUpdates:batchUpdates completion:batchUpdatesCompletion];
|
||||
} else {
|
||||
// HACK: We use `UIView.animateWithDuration:0` rather than `UIView.performWithAnimation` to work around a UIKit
|
||||
// Crash like:
|
||||
//
|
||||
// *** Assertion failure in -[ConversationViewLayout prepareForCollectionViewUpdates:],
|
||||
// /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7.47/UICollectionViewLayout.m:760
|
||||
// *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'While
|
||||
// preparing update a visible view at <NSIndexPath: 0xc000000011c00016> {length = 2, path = 0 - 142} wasn't
|
||||
// found in the current data model and was not in an update animation. This is an internal error.'
|
||||
//
|
||||
// I'm unclear if this is a bug in UIKit, or if we're doing something crazy in
|
||||
// ConversationViewLayout#prepareLayout. To reproduce, rapidily insert and delete items into the conversation.
|
||||
// See `DebugUIMessages#thrashCellsInThread:`
|
||||
[UIView animateWithDuration:0.0
|
||||
@try {
|
||||
if (shouldAnimateUpdates) {
|
||||
[self.collectionView performBatchUpdates:batchUpdates completion:batchUpdatesCompletion];
|
||||
} else {
|
||||
// HACK: We use `UIView.animateWithDuration:0` rather than `UIView.performWithAnimation` to work around a
|
||||
// UIKit Crash like:
|
||||
//
|
||||
// *** Assertion failure in -[ConversationViewLayout prepareForCollectionViewUpdates:],
|
||||
// /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7.47/UICollectionViewLayout.m:760
|
||||
// *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'While
|
||||
// preparing update a visible view at <NSIndexPath: 0xc000000011c00016> {length = 2, path = 0 - 142}
|
||||
// wasn't found in the current data model and was not in an update animation. This is an internal
|
||||
// error.'
|
||||
//
|
||||
// I'm unclear if this is a bug in UIKit, or if we're doing something crazy in
|
||||
// ConversationViewLayout#prepareLayout. To reproduce, rapidily insert and delete items into the
|
||||
// conversation. See `DebugUIMessages#thrashCellsInThread:`
|
||||
[UIView
|
||||
animateWithDuration:0.0
|
||||
animations:^{
|
||||
[self.collectionView performBatchUpdates:batchUpdates completion:batchUpdatesCompletion];
|
||||
if (scrollToBottom) {
|
||||
[self scrollToBottomAnimated:shouldAnimateUpdates];
|
||||
}
|
||||
}];
|
||||
}
|
||||
} @catch (NSException *exception) {
|
||||
OWSFail(@"%@ exception: %@ of type: %@ with reason: %@, user info: %@.",
|
||||
self.logTag,
|
||||
exception.description,
|
||||
exception.name,
|
||||
exception.reason,
|
||||
exception.userInfo);
|
||||
@throw exception;
|
||||
}
|
||||
|
||||
self.lastReloadDate = [NSDate new];
|
||||
|
|
Loading…
Reference in a new issue