崩掉了!
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 CoreFoundation 0x0000000183d30bc8 -[__NSCFString getCString:maxLength:encoding:] + 4 1 Foundation 0x00000001847c1584 NSSelectorFromString + 96 2 xxxx 0x0000000102fe1c04 mt_forwardInvocation + 252932 (MessageThrottle.m:823) 3 CoreFoundation 0x0000000183e342d4 forwarding + 624 4 CoreFoundation 0x0000000183d1a41c CF_forwarding_prep_0 + 92 5 CoreFoundation 0x0000000183e36580 invoking + 144 6 CoreFoundation 0x0000000183d15748 -[NSInvocation invoke] + 284 7 CoreFoundation 0x0000000183d1a56c -[NSInvocation invokeWithTarget:] + 60 8 xxxx 0x0000000102fe1f40 mt_forwardInvocation + 253760 (MessageThrottle.m:0) 9 CoreFoundation 0x0000000183e342d4 forwarding + 624 10 CoreFoundation 0x0000000183d1a41c CF_forwarding_prep_0 + 92 11 CoreFoundation 0x0000000183e36580 invoking + 144 12 CoreFoundation 0x0000000183d15748 -[NSInvocation invoke] + 284 13 CoreFoundation 0x0000000183d1a56c -[NSInvocation invokeWithTarget:] + 60 14 xxxx 0x0000000102fe1f40 mt_forwardInvocation + 253760 (MessageThrottle.m:0) 15 CoreFoundation 0x0000000183e342d4 forwarding + 624 16 CoreFoundation 0x0000000183d1a41c CF_forwarding_prep_0 + 92 17 CoreFoundation 0x0000000183e36580 invoking + 144 18 CoreFoundation 0x0000000183d15748 -[NSInvocation invoke] + 284 19 CoreFoundation 0x0000000183d1a56c -[NSInvocation invokeWithTarget:] + 60 20 xxxx 0x0000000102fe1f40 mt_forwardInvocation + 253760 (MessageThrottle.m:0) 21 CoreFoundation 0x0000000183e342d4 forwarding + 624 22 CoreFoundation 0x0000000183d1a41c CF_forwarding_prep_0 + 92 23 CoreFoundation 0x0000000183e36580 invoking + 144 24 CoreFoundation 0x0000000183d15748 -[NSInvocation invoke] + 284 25 CoreFoundation 0x0000000183d1a56c -[NSInvocation invokeWithTarget:] + 60 26 xxxx 0x0000000102fe1f40 mt_forwardInvocation + 253760 (MessageThrottle.m:0) 27 CoreFoundation 0x0000000183e342d4 forwarding + 624 28 CoreFoundation 0x0000000183d1a41c CF_forwarding_prep_0 + 92 29 CoreFoundation 0x0000000183e36580 invoking + 144 30 CoreFoundation 0x0000000183d15748 -[NSInvocation invoke] + 284 31 CoreFoundation 0x0000000183d1a56c -[NSInvocation invokeWithTarget:] + 60
调用如下:
[self.collectionView mt_limitSelector:@selector(beginHeaderRefresh) oncePerDuration:5 usingMode:MTPerformModeFirstly];
每次 viewWillAppear 的时候调通 [ self.collectionView beginHeaderRefresh]
@FanJianRong 请问下你使用的版本是什么呢?是否对 collectionView 的对象和父类同时限频了呢?或者对 collectionView 使用了 KVO?
前一天下下来的最新版本;只有这一处地方试用;下拉刷新使用的 MJRefresh ,有一处使用到 KVO
NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld; [self.scrollView addObserver:self forKeyPath:MJRefreshKeyPathContentOffset options:options context:nil]; [self.scrollView addObserver:self forKeyPath:MJRefreshKeyPathContentSize options:options context:nil]; self.pan = self.scrollView.panGestureRecognizer; [self.pan addObserver:self forKeyPath:MJRefreshKeyPathPanState options:options context:nil];
@FanJianRong 如果方便的话,能提供下工程代码或者能复现的 demo 么?
因为 KVO 的对象不是 collectionView,还找不到问题原因。
beginHeaderRefresh 方法是否使用 Method Swizzling 之类的 hook 过呢?
Demo.zip 工程复现不了,不过这demo有点问题,主要看下所用到的工具吧,跟这个demo的差不多。
@FanJianRong 我推测应该跟 KVO 有关系,而且MJ使用 KVO 和 MessageThrottle hook 的顺序,以及 remove KVO 和 hook 的顺序都会影响结果。要是能有个复现的 demo 就好了。 还有一种可能就是,你也使用了 Aspects 之类的工具 Hook 了UICollectionView 的父类。
@FanJianRong 感觉堆栈信息不全,因为 mt_forwardInvocation 会调用 mt_handleInvocation 或 mt_executeOrigForwardInvocation,堆栈里找不到呀。
@yulingtianxia log.txt
@FanJianRong 感谢提供 log!不过本人才疏学浅,还是没找到必现场景和原因。。。哎