IOS phone call state change

#import <CoreTelephony/CTCall.h>
#import <CoreTelephony/CTCallCenter.h>

- (void)onPhoneCallStateChanged {
    CTCallCenter *callCenter = [[CTCallCenter alloc] init];
    callCenter.callEventHandler = ^(CTCall*call) {
        if ([CTCallStateDisconnected isEqualToString:call.callState]) {
            NSLog(@"%@", call.callState);
        }
        else if([CTCallStateConnected isEqualToString:call.callState]){
            NSLog(@"%@", call.callState);
        }
        else if([CTCallStateIncoming isEqualToString:call.callState]){
            NSLog(@"%@", call.callState);
        }
        else if ([CTCallStateDialing isEqualToString:call.callState]){
            NSLog(@"%@", call.callState);
        }
    };
}



你可能感兴趣的:(ios,call,change,state,phone)