可以监听有电话来时候的一些状态
#import <coretelephony ctcallcenter.h=""> #import <coretelephony ctcall.h=""> -(void)detectCall { CTCallCenter *callCenter = [[CTCallCenter alloc] init]; callCenter.callEventHandler=^(CTCall* call) { if (call.callState == CTCallStateDisconnected) { NSLog(@"Call has been disconnected"); } else if (call.callState == CTCallStateConnected) { NSLog(@"Call has just been connected"); } else if(call.callState == CTCallStateIncoming) { NSLog(@"Call is incoming"); } else if (call.callState ==CTCallStateDialing) { NSLog(@"call is dialing"); } else { NSLog(@"Nothing is done"); } }; } </coretelephony></coretelephony>
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/app/5150.html