ios如何监听手机来电状态

导入

具体代码:

self.callCenter = [[CTCallCenter alloc] init];

self.callCenter.callEventHandler = ^(CTCall* call) {

if ([call.callState isEqualToString:CTCallStateDisconnected])

{

NSLog(@"Call has been disconnected");

}

else if ([call.callState isEqualToString:CTCallStateConnected])

{

NSLog(@"Call has just been connected");

}

else if([call.callState isEqualToString:CTCallStateIncoming])

{

NSLog(@"Call is incoming");

}

else if ([call.callState isEqualToString:CTCallStateDialing])

{

NSLog(@"call is dialing");

}

else

{

NSLog(@"Nothing is done");

}

};

你可能感兴趣的:(ios如何监听手机来电状态)