CTCallCenter 的使用心得

注意:

你把center写成成员变量
  

 callCenter = [CTCallCenter new];

//    CTCallCenter *callCenter = [CTCallCenter new];


    __weak typeof(self) weakSelf = self;

    callCenter.callEventHandler = ^(CTCall *call){

        if ([call.callState isEqualToString:CTCallStateDisconnected]){

            NSLog(@"Call has been disconnected");

            if (!_isManualStopPlay) [weakSelf play];

        }

        else if ([call.callState isEqualToString:CTCallStateConnected]){

            NSLog(@"Call has just been connected");

        }

        else if([call.callState isEqualToString:CTCallStateIncoming]){

            NSLog(@"Call is incoming");

        }

        else if ([call.callState isEqualToString:CTCallStateDialing]){

            NSLog(@"call is dialing");

        }

        else{

            NSLog(@"Nothing is done");

        }

    };

你可能感兴趣的:(CTCallCenter 的使用心得)