How to hook methods of MPIncomingPhoneCallControll

2019-04-16 05:12发布

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条回答
女痞
2楼-- · 2019-04-16 05:38

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.

查看更多
登录 后发表回答