Comments (5)
@ZhangTonghai 没太看懂 crash 的原因,是 EditViewController_8_XXXX
这个类已经不存在了么?麻烦能提供个能复现的 demo 么?
from messagethrottle.
手误关闭了issue,叹气!!
from messagethrottle.
复现步骤:
1、运行后点击第一个页面红色cell,进入第二个vc
2、返回第一个vc并重复步骤1
3、重复步骤2 ,出现崩溃,如下图
神策业务的大致流程是这样的:
- (void)sensorsdata_setDelegate:(id <UICollectionViewDelegate>)delegate(UIScrollView+AutoTrack.m)
+ (void)hookDidSelectMethodWithDelegate:(id)delegate(SADelegateProxy.m)
+ (NSString *)generateSensorsClassName:(id)obj(SADelegateProxy.m)
...
希望提供的资料有用。
from messagethrottle.
补充:
在设置collectionView的delegate之前调用mt_limitSelector则不会有问题,所以我还没断定问题在这边还是神策方面,忘指点。
from messagethrottle.
Crash 原因是 MessageThrottle 这边直接使用了神策动态创建的子类,然后下次神策创建新的子类时,会销毁旧创建的子类,导致下次 MessageThrottle 访问到不存在的类而 crash。神策使用 objc_disposeClassPair()
函数销毁创建的类时,一旦这个类存在实例,或存在其子类的实例,那么就会发生问题。因为神策在销毁子类之前并没有按照苹果官网文档的要求进行检查(是否存在实例或子类),而是暴力销毁,所以发生在神策之后的 Hook 操作都会受此影响,此问题需要神策来修复:
/**
* Destroy a class and its associated metaclass.
*
* @param cls The class to be destroyed. It must have been allocated with
* \c objc_allocateClassPair
*
* @warning Do not call if instances of this class or a subclass exist.
*/
OBJC_EXPORT void
objc_disposeClassPair(Class _Nonnull cls)
OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
『在设置collectionView的delegate之前调用mt_limitSelector则不会有问题』,是因为 MessageThrottle 先创建了子类并持有,神策后创建的子类并销毁,这样就影响不到 MessageThrottle 了。其实神策反复创建有计数功能的子类并逐个销毁的做法有一定风险,如果换成用属性等来计数可能会更好。
from messagethrottle.
Related Issues (17)
- Bug收集平台获取的崩溃信息 HOT 1
- 导入这个框架,如果没有使用,会有影响吗? HOT 3
- MTPerformModeLast下多线程野指针 HOT 2
- 请问为何限制同一个target的多个Rule HOT 2
- [[NSDate date] timeIntervalSince1970]会受系统时间影响,用CACurrentMediaTime()比较是不是好一点。 HOT 11
- MTPerformModeLast HOT 1
- tableView使用MessageThrottle崩掉了,在工程中偶现,bugly收集到了一些 HOT 20
- 只在iOS16的模拟器上crash HOT 3
- applyRule: 判断逻辑疑问? HOT 1
- 跟想象中不同啊 HOT 2
- 也许可以换一种调用方式 HOT 6
- 阅读源码有处不理解的 HOT 1
- A message can only have one rule per class hierarchy. HOT 4
- forwardInvocation问题
- Example in Swift HOT 1
- 崩掉了! HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from messagethrottle.