1. 关于iPhone系统电话事件监听

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

- (void)listenCallEvent
{
    CTCallCenter *callCenter = [[CTCallCenter alloc] init];
    [callCenter setCallEventHandler:^(CTCall *call) {
        if (call.callState == CTCallStateConnected)
        {
            NSLog(@"Call has been connected!");
        }
        else if (call.callState == CTCallStateDisconnected)
        {
            NSLog(@"Call has been disconnected!");
        }
        else if (call.callState == CTCallStateIncoming)
        {
            NSLog(@"Call is incoming!");
        }
        else if (call.callState == CTCallStateDialing)
        {
            NSLog(@"Call is dialing!");
        }
        else
        {
            NSLog(@"None State!");
        }
    }];
}// listenCallEvent

 

posted on 2013-03-31 21:17  BankFish  阅读(982)  评论(0编辑  收藏  举报