監聽電話來時候的一些狀態

#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");
        }
    };
相關文章
相關標籤/搜索