Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

崩掉了! #9

Open
Jonas1024 opened this issue Aug 21, 2018 · 8 comments
Open

崩掉了! #9

Jonas1024 opened this issue Aug 21, 2018 · 8 comments

Comments

@Jonas1024
Copy link

Jonas1024 commented Aug 21, 2018

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]

@yulingtianxia
Copy link
Owner

yulingtianxia commented Aug 21, 2018

@FanJianRong 请问下你使用的版本是什么呢?是否对 collectionView 的对象和父类同时限频了呢?或者对 collectionView 使用了 KVO?

@Jonas1024
Copy link
Author

前一天下下来的最新版本;只有这一处地方试用;下拉刷新使用的 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];

@yulingtianxia
Copy link
Owner

yulingtianxia commented Aug 22, 2018

@FanJianRong 如果方便的话,能提供下工程代码或者能复现的 demo 么?
因为 KVO 的对象不是 collectionView,还找不到问题原因。
beginHeaderRefresh 方法是否使用 Method Swizzling 之类的 hook 过呢?

@Jonas1024
Copy link
Author

Demo.zip
工程复现不了,不过这demo有点问题,主要看下所用到的工具吧,跟这个demo的差不多。

@yulingtianxia
Copy link
Owner

yulingtianxia commented Aug 22, 2018

@FanJianRong 我推测应该跟 KVO 有关系,而且MJ使用 KVO 和 MessageThrottle hook 的顺序,以及 remove KVO 和 hook 的顺序都会影响结果。要是能有个复现的 demo 就好了。
还有一种可能就是,你也使用了 Aspects 之类的工具 Hook 了UICollectionView 的父类。

@yulingtianxia
Copy link
Owner

@FanJianRong 感觉堆栈信息不全,因为 mt_forwardInvocation 会调用 mt_handleInvocationmt_executeOrigForwardInvocation,堆栈里找不到呀。

@Jonas1024
Copy link
Author

@yulingtianxia
log.txt

@yulingtianxia
Copy link
Owner

@FanJianRong 感谢提供 log!不过本人才疏学浅,还是没找到必现场景和原因。。。哎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants