未在目标c中调用CallEventhandler [英] CallEventhandler not invoked in objective c

查看:61
本文介绍了未在目标c中调用CallEventhandler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在通话结束时获得通话状态,但不会像线路总是返回false那样调用我的事件

i have to get call status on the end of the call but my event is not invoked following like line always return false

[callCenter setCallEventHandler:^(CTCall *调用)

[callCenter setCallEventHandler: ^(CTCall* call)

这是我的代码

CTCallCenter *callCenter = [[CTCallCenter alloc] init];
callCenter.callEventHandler=^(CTCall* call)
{

    if(call.callState == CTCallStateDialing)
    {
        //The call state, before connection is established, when the user initiates the call.
        NSLog(@"Call is dailing");
    }
    if(call.callState == CTCallStateIncoming)
    {
        //The call state, before connection is established, when a call is incoming but not yet answered by the user.
        NSLog(@"Call is Coming");
    }

    if(call.callState == CTCallStateConnected)
    {
        //The call state when the call is fully established for all parties involved.
        NSLog(@"Call Connected");
    }   

    if(call.callState == CTCallStateDisconnected)
    {
        //The call state Ended.
        NSLog(@"Call Ended");
    }

};

任何帮助都会得到极大的帮助

any help will be greatly appriciated

推荐答案

您的代码看起来不错;但是,如果您的应用在通话事件期间被挂起,则事件处理程序将不会被调用.

Your code looks good; however, your event handler will not be invoked if your app is suspended during the call event.

来源: CTCallCenter类参考

如果在发生呼叫事件时您的应用程序处于活动状态,则 系统立即将事件分派给您的处理程序.但是,请致电 您的应用程序被暂停时,事件也可能发生.尽管 它被挂起,您的应用程序不接收呼叫事件.什么时候 您的应用程序恢复活动状态,它收到一个调用 每个更改状态的呼叫的事件-无论有多少个状态 更改您的应用程序暂停期间经历的通话.这 在您的应用程序上将单个呼叫事件发送给您的处理程序 返回到活动状态,描述当时的通话状态 时间.

If your application is active when a call event takes place, the system dispatches the event to your handler immediately. However, call events can also take place while your application is suspended. While it is suspended, your application does not receive call events. When your application resumes the active state, it receives a single call event for each call that changed state—no matter how many state changes the call experienced while your application was suspended. The single call event sent to your handler, upon your application returning to the active state, describes the call’s state at that time.

这篇关于未在目标c中调用CallEventhandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆