监听电话来时候的一些状态

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

/// 监听拨打电话状态
    _callCenter = [[CTCallCenter alloc] init];
    _callCenter.callEventHandler=^(CTCall* call)
    {
        if (call.callState == CTCallStateDisconnected)
        {
            NSLog(@"挂断电话");
            
        }
        else if (call.callState == CTCallStateConnected)
        {
            NSLog(@"电话刚连接通");
        }
        else if(call.callState == CTCallStateIncoming)
        {
            NSLog(@"有电话打进来");
            
        }
        else if (call.callState ==CTCallStateDialing)
        {
            NSLog(@"拨打电话");
        }
        else
        {
            NSLog(@"Nothing is done");
        }
    };

 

posted @ 2015-07-30 17:54  菜鸟程序猿  阅读(359)  评论(0编辑  收藏  举报