
1 fly2never May 20, 2013 什么叫勾起来? |
2 offspring May 20, 2013 表示看不懂... |
4 thedevil5032 May 20, 2013 |
5 alexrezit May 20, 2013 楼主是这个意思么? if ([oo respondsToSelector:@selector(xx:)] { ... } |
6 anerevol May 21, 2013 楼主是想问为什么会crash? 你要是用的mobileSubstrate hook的话,如果该类没有这个方法也不会crash的, 只是不会调用而已。 觉得crash跟hook本身没关系的,是其他地方的问题吧 |
9 alexrezit May 21, 2013 |
10 kshatriya May 21, 2013 method swizzle是方法混合器, 通过SEL查IMP, 然后把IMP搅在一起 |
11 kshatriya May 21, 2013 void Swizzle(Class c, SEL orig, SEL new) { Method origMethod = class_getInstanceMethod(c, orig); Method newMethod = class_getInstanceMethod(c, new); if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod)); else method_exchangeImplementations(origMethod, newMethod); } |
12 kshatriya May 21, 2013 强烈要求v2ex可以有代码格式化+高亮语法 |
13 loading May 21, 2013 挂钩都是作恶的开始吧… |
14 kshatriya May 21, 2013 crash普通情况下都是发送了空消息导致, 发之前做检查吧 hook一般都是先把orig函数的指针存一份, 然后覆盖, 在返回的时候返回给之前保存的orig函数指针, 只处理入参!别做多余的操作! 好混乱, 语死早啊 |
15 wezzard May 21, 2013 method swizzling 不能上架? |