We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
因KVO防护需求,需要在dealloc中做一些处理,所以重定向了dealloc。但会引发原有dealloc方法的未处理,所以[self swizzleInstanceMethodWithOriginSel:NSSelectorFromString(@"dealloc") swizzledSel:@selector(baymax_dealloc)];应改为替换并添加原有dealloc消息转发。
The text was updated successfully, but these errors were encountered:
@gonghongxia 额,不是很明白你说的是哪个情况。原有dealloc方法为什么会未处理呢?不过关于dealloc方法的处理是可以单独拎出来写的,当时只是为了尝试下方案的可行性,零零散散地写得比较随便。另外,测试用例也可以优化下,现在这样有点low。哈哈。可以提供个思路给你,有空的话可以直接写完提PR。测试用例这块,可以分为不同的tester写,然后通过runtime去遍历tester的方法,最终效果大概是首页是不同类型的tester,点击tester后,到另一个页面,是具体的每个Test Case。大致是这样子的:
dealloc
+ (instancetype)tester:(WYCrashDoctorType)type { switch (type) { case WYCrashDoctorUnrecognizedSelector: return [WYUnrecognizedSelectorTester new]; case WYCrashDoctorCollection: return [WYCollectionTester new]; case WYCrashDoctorKVO: return [WYKVOTester new]; case WYCrashDoctorTimer: return [WYTimerTester new]; case WYCrashDoctorString: { return [WYStringTester new]; case WYCrashDoctorNotification: return [WYNotificationTester new]; case WYCrashDoctorUI: return [WYUITester new]; case WYCrashDoctorBadAccess: return [WYBadAccessTester new]; case WYCrashDoctorBooting: return [WYBootingTester new]; } default: return [self new]; } }
- (NSArray *)testCaseSelectors { NSMutableArray *seletors = @[].mutableCopy; unsigned int outCount; Method *methodList = class_copyMethodList([self class], &outCount); for (unsigned int i = 0; i < outCount; i++) { Method method = methodList[i]; NSString *selStr = NSStringFromSelector(method_getName(method)); if ([selStr hasPrefix:@"test_"]) { [seletors addObject:selStr]; } } free(methodList); return seletors; }
Sorry, something went wrong.
No branches or pull requests
因KVO防护需求,需要在dealloc中做一些处理,所以重定向了dealloc。但会引发原有dealloc方法的未处理,所以[self swizzleInstanceMethodWithOriginSel:NSSelectorFromString(@"dealloc") swizzledSel:@selector(baymax_dealloc)];应改为替换并添加原有dealloc消息转发。
The text was updated successfully, but these errors were encountered: