ios|ios 程序内监听系统来电

导入头文件

#import #import

遵循代理
CXCallObserverDelegate

创建实例
@property(nonatomic, strong) CXCallObserver *callCenter;

初始化
self.callCenter = [CXCallObserver new]; [self.callCenter setDelegate:self queue:dispatch_get_main_queue()];

【ios|ios 程序内监听系统来电】代理事件
//MARK: CXCallObserverDelegate - (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call { NSLog(@"outgoing :%donHold :%dhasConnected :%dhasEnded :%d",call.outgoing,call.onHold,call.hasConnected,call.hasEnded); /* 拨打:outgoing :1onHold :0hasConnected :0hasEnded :0 拒绝:outgoing :1onHold :0hasConnected :0hasEnded :1 链接:outgoing :1onHold :0hasConnected :1hasEnded :0 挂断:outgoing :1onHold :0hasConnected :1hasEnded :1 对方未接听时挂断:outgoing :1onHold :0hasConnected :0hasEnded :1新来电话:outgoing :0onHold :0hasConnected :0hasEnded :0 保留并接听:outgoing :1onHold :1hasConnected :1hasEnded :0 另一个挂掉:outgoing :0onHold :0hasConnected :1hasEnded :0 保持链接:outgoing :1onHold :0hasConnected :1hasEnded :1 对方挂掉:outgoing :0onHold :0hasConnected :1hasEnded :1 */ }

    推荐阅读