You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在 SwiftUI 页面使用加载,页面返回销毁。此时崩溃在 MJRefreshComponent line 105 removeObservers() 方法中。
崩溃日志:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <MJRefreshBackNormalFooter 0x126b7e7b0> for the key path "contentOffset" from <TtGC7SwiftUI16PlatformViewHostGVS_P10$1c8b6b12832PlatformViewRepresentableAdaptorV9JKSwiftUI26SwiftUIMJRefreshFooterView_ 0x126b7f3d0> because it is not registered as an observer.'
必现/偶发?
必现
怎么样重现这个bug
崩溃日志:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <MJRefreshBackNormalFooter 0x126b7e7b0> for the key path "contentOffset" from <TtGC7SwiftUI16PlatformViewHostGVS_P10$1c8b6b12832PlatformViewRepresentableAdaptorV9JKSwiftUI26SwiftUIMJRefreshFooterView_ 0x126b7f3d0> because it is not registered as an observer.'
分析原因:
{
[self.superview removeObserver:self forKeyPath:MJRefreshKeyPathContentOffset];
[self.superview removeObserver:self forKeyPath:MJRefreshKeyPathContentSize];
[self.pan removeObserver:self forKeyPath:MJRefreshKeyPathPanState];
self.pan = nil;
}
解决建议:
if (self.superview && ![self.superview isKindOfClass:[UIScrollView class]]) return;
运行环境
The text was updated successfully, but these errors were encountered: