-->

How to hook methods of MPIncomingPhoneCallControll

2019-04-16 05:28发布

问题:

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_");

to hook updateLCDWithName:label:breakPoint:, but it failed.

How can I do this?

回答1:

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.