I\'m working on a personal tweak for iOS. I want to disconnect/connect a phone call before the phone would show anything. I\'m hooking into the initWithAlertController
For iOS 8.*:
The hooking seems pretty easy with Theos/Logos.
Example Tweak.xm file (you need the TelephonyUtilities private framework headers for 8.1):
#import "TelephonyUtilities/TUTelephonyCall.h"
%hook MPTelephonyManager
-(void)displayAlertForCall:(TUTelephonyCall*)phoneCall { // for iOS 9: displayAlertForCallIfNecessary
NSLog(@"hooked displayAlertForCall method");
if ([[NSBundle mainBundle].bundleIdentifier isEqualToString:@"com.apple.springboard"]) { // (don't know if required)
[phoneCall answer]; // or [phoneCall disconnect];
}
%orig;
}
%end
%ctor {
if ([[NSBundle bundleWithPath:@"/System/Library/SpringBoardPlugins/IncomingCall.servicebundle"] load]) {
NSLog(@"IncomingCall.servicebundle loaded succesfully!");
}
else {
NSLog(@"IncomingCall.servicebundle did not load succesfully.");
}
}
Credit to Phillip Tennen (https://github.com/codyd51/CallConnect)