如何挂钩MPIncomingPhoneCallController的方法? [英] How to hook methods of MPIncomingPhoneCallController?

查看:120
本文介绍了如何挂钩MPIncomingPhoneCallController的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在iOS 5中挂钩类 MPIncomingPhoneCallController 的方法,以便在来电时执行某些操作。我使用

I want to hook methods of class MPIncomingPhoneCallController in iOS 5 to do something when a call comes. I use

Class _$MPIncomingPhoneCallController = objc_getClass("MPIncomingPhoneCallController");

MSHookMessage(_$MPIncomingPhoneCallController, 
              @selector(updateLCDWithName:label:breakPoint:), 
             (IMP) &Hook_LCD, 
             "pre_");

挂钩 updateLCDWithName:label:breakPoint: ,但它失败了。

我该怎么做?

推荐答案

您尝试挂钩的类位于IncomingCall.serviceBundle中,只有在有来电时才会在SpringBoard中加载。要确定何时实际加载,您需要挂钩 SBPluginManager loadPluginBundle:。等到装载的捆绑包 com.apple.mobilephone.incomingcall 。只有这样你才能挂钩你想要的东西。

Class you are trying to hook is located in IncomingCall.serviceBundle which gets loaded in SpringBoard only when there is incoming call. To determine when it's actually loaded you need to hook SBPluginManager loadPluginBundle:. Wait until loaded bundle is com.apple.mobilephone.incomingcall. Only then you can hook what you want.

这篇关于如何挂钩MPIncomingPhoneCallController的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆