具体的做法是:会先把objectc的API勾出来,调用我们的写的函数,然后在去调用原来的API。
|
fly2neverMay 20, 2013
1
什么叫勾起来?
|
|
offspringMay 20, 2013
2
表示看不懂...
|
|
thedevil5032May 20, 2013
4
|
|
alexrezitMay 20, 2013
5
楼主是这个意思么?
if ([oo respondsToSelector:@selector(xx:)] { ... } |
|
anerevolMay 21, 2013
6
楼主是想问为什么会crash? 你要是用的mobileSubstrate hook的话,如果该类没有这个方法也不会crash的, 只是不会调用而已。 觉得crash跟hook本身没关系的,是其他地方的问题吧
|
|
alexrezitMay 21, 2013
9
|
|
kshatriyaMay 21, 2013
10
method swizzle是方法混合器, 通过SEL查IMP, 然后把IMP搅在一起
|
|
kshatriyaMay 21, 2013
11
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); } |
|
kshatriyaMay 21, 2013
12
强烈要求v2ex可以有代码格式化+高亮语法
|
|
loadingMay 21, 2013
13
挂钩都是作恶的开始吧…
|
|
kshatriyaMay 21, 2013
14
crash普通情况下都是发送了空消息导致, 发之前做检查吧
hook一般都是先把orig函数的指针存一份, 然后覆盖, 在返回的时候返回给之前保存的orig函数指针, 只处理入参!别做多余的操作! 好混乱, 语死早啊 |
|
wezzardMay 21, 2013
15
method swizzling 不能上架麼?
|