我从Crashlytics收到此错误消息。
异常类型:EXC_BAD_ACCESS代码:KERN_INVALID_ADDRESS位于0xd000000c
Thread 0: Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x3b283b26 objc_msgSend + 5
1 TestApp 0x0012b239 -[EasyTableView scrollViewDidScroll:] (EasyTableView.m:291)
2 UIKit 0x339f006d -[UIScrollView(UIScrollViewInternal) _notifyDidScroll] + 64
3 UIKit 0x3376d375 -[UIScrollView setContentOffset:] + 596
4 UIKit 0x3381b005 -[UITableView setContentOffset:] + 320
5 UIKit 0x3376d0e7 -[UIScrollView _adjustContentOffsetIfNecessary] + 1354
6 UIKit 0x33820773 -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:tramplingDragFlags:] + 414
7 UIKit 0x338205cb -[UIScrollView(UIScrollViewInternal) _stopScrollingNotify:pin:] + 30
8 UIKit 0x33820587 -[UIScrollView removeFromSuperview] + 30
9 UIKit 0x3374e687 -[UIView dealloc] + 366
10 liboainject.dylib 0x002d86cd ___swapMethods_block_invoke_4
11 UIKit 0x3374e687 -[UIView dealloc] + 366
12 liboainject.dylib 0x002d86cd ___swapMethods_block_invoke_4
13 UIKit 0x3374e687 -[UIView dealloc] + 366
14 liboainject.dylib 0x002d86cd ___swapMethods_block_invoke_4
15 libobjc.A.dylib 0x3b285007 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 358
16 liboainject.dylib 0x002d7d33 __oa__objc_autoreleasePoolPop
17 CoreFoundation 0x30f10a41 _CFAutoreleasePoolPop + 16
18 UIKit 0x337464cd _wrapRunLoopWithAutoreleasePoolHandler + 36
19 CoreFoundation 0x30fa81d5 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
20 CoreFoundation 0x30fa5b79 __CFRunLoopDoObservers + 284
21 CoreFoundation 0x30fa5ebb __CFRunLoopRun + 730
22 CoreFoundation 0x30f10ce7 CFRunLoopRunSpecific + 522
23 CoreFoundation 0x30f10acb CFRunLoopRunInMode + 106
24 GraphicsServices 0x35bfa283 GSEventRunModal + 138
25 UIKit 0x337b2a41 UIApplicationMain + 1136
26 TestApp 0x000ea19d main (main.m:16)
我的代码(EasyTableView.m:291)如下所示
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if ([delegate respondsToSelector:@selector(easyTableView:scrolledToOffset:)])
[delegate easyTableView:self scrolledToOffset:self.contentOffset];
}
- (CGPoint)contentOffset {
CGPoint offset = self.tableView.contentOffset;
if (_orientation == EasyTableViewOrientationHorizontal)
offset = CGPointMake(offset.y, offset.x);
return offset;
}
- (void)setContentOffset:(CGPoint)offset {
if (_orientation == EasyTableViewOrientationHorizontal)
self.tableView.contentOffset = CGPointMake(offset.y, offset.x);
else
self.tableView.contentOffset = offset;
}
我尝试使用Zombie进行调试并查看了仪器泄漏。但我找不到任何东西。我该如何解决这个问题?提前致谢
答案 0 :(得分:12)
您应该清除scrollView
tableView
和dealloc
代表
答案 1 :(得分:-1)
在斯威夫特:
deinit {
self.scrollView.delegate = nil
self.tableView.delegate = nil
}