<i id='X755Y'><tr id='X755Y'><dt id='X755Y'><q id='X755Y'><span id='X755Y'><b id='X755Y'><form id='X755Y'><ins id='X755Y'></ins><ul id='X755Y'></ul><sub id='X755Y'></sub></form><legend id='X755Y'></legend><bdo id='X755Y'><pre id='X755Y'><center id='X755Y'></center></pre></bdo></b><th id='X755Y'></th></span></q></dt></tr></i><div id='X755Y'><tfoot id='X755Y'></tfoot><dl id='X755Y'><fieldset id='X755Y'></fieldset></dl></div>
    1. <tfoot id='X755Y'></tfoot>

      <small id='X755Y'></small><noframes id='X755Y'>

          <bdo id='X755Y'></bdo><ul id='X755Y'></ul>
        <legend id='X755Y'><style id='X755Y'><dir id='X755Y'><q id='X755Y'></q></dir></style></legend>

        在 iOS4 中检测通话状态

        时间:2023-10-03
      1. <tfoot id='aTYfS'></tfoot>

            <tbody id='aTYfS'></tbody>
        • <i id='aTYfS'><tr id='aTYfS'><dt id='aTYfS'><q id='aTYfS'><span id='aTYfS'><b id='aTYfS'><form id='aTYfS'><ins id='aTYfS'></ins><ul id='aTYfS'></ul><sub id='aTYfS'></sub></form><legend id='aTYfS'></legend><bdo id='aTYfS'><pre id='aTYfS'><center id='aTYfS'></center></pre></bdo></b><th id='aTYfS'></th></span></q></dt></tr></i><div id='aTYfS'><tfoot id='aTYfS'></tfoot><dl id='aTYfS'><fieldset id='aTYfS'></fieldset></dl></div>
          1. <legend id='aTYfS'><style id='aTYfS'><dir id='aTYfS'><q id='aTYfS'></q></dir></style></legend>

              <bdo id='aTYfS'></bdo><ul id='aTYfS'></ul>

              <small id='aTYfS'></small><noframes id='aTYfS'>

                • 本文介绍了在 iOS4 中检测通话状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想知道是否有可能检测到用户是否正在从当前处于后台的应用程序调用.

                  I would like to know if there is a possibility to detect if the user is in call from an application that is currently in background.

                  或者,如果通话是从我的应用发起的,则在通话结束时收到通知.

                  Or, receive a notification when the call is ended if the call was initiated from my app.

                  或者,更重要的是 - 是否有可能检测到哪个应用程序在前台?
                  我不相信这是可能的,但我不得不尝试...... ;-)

                  Or, even more than that - is there a possibility to detect which app is in foreground?
                  I don't believe that this is possible but I had to try... ;-)

                  任何信息将不胜感激.

                  谢谢.

                  推荐答案

                  CTCallCenter中,有一个方法,callEventHandler,你可以传递一个会被调用的block当呼叫事件发生时.在这个块中,您将被传递一个 CTCall 对象,并且可以获得 callState.因此,您可以在通话开始或结束时收到通知,并进行适当的处理.你无法得知是哪个应用发起了调用,但是如果你在调用的时候设置了一个 ivar,你就可以知道是你的应用发起了调用.

                  In CTCallCenter, there is a method, callEventHandler that you can pass a block that will get called when call events happen. In this block, you'll be passed a CTCall object, and can get the callState. So, you can get a notification when a call is initiated or ended, and handle it appropriately. You can't get which application initiated the call, but if you set an ivar when you make the call, you can tell that it's your application that made the call.

                  例如:

                  CTCallCenter *callCenter = [[CTCallCenter alloc] init];
                  callCenter.callEventHandler=^(CTCall* call){
                      if (call.callState == CTCallStateDisconnected)
                      { 
                          //handle disconnect
                      }
                  };
                  

                  重新阅读您的问题,您希望在被暂停期间进行这些活动,对吗?我认为这是不可能的.

                  Re-reading your question, you want these events while you are suspended, correct? I don't think that's possible.

                  来自 文档:

                  如果您的应用程序在调用事件发生时处于活动状态,则系统会立即将该事件分派给您的处理程序.但是,调用事件也可能在您的应用程序暂停时发生.当它被挂起时,您的应用程序不会收到呼叫事件.当您的应用程序恢复活动状态时,它会为每个更改状态的调用接收一个调用事件 - 无论您的应用程序暂停时调用经历了多少状态更改.当您的应用程序返回活动状态时,发送到您的处理程序的单个调用事件描述了当时调用的状态.

                  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.

                  这篇关于在 iOS4 中检测通话状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:iOS 4 真的支持 ARC 吗?iOS 4.2 SDK 在链接时缺少与 ARC 相关的符号 下一篇:在 iOS 4+ 中从 ABAddressBook 获取特定的 ABSource

                  相关文章

                  • <bdo id='iXldq'></bdo><ul id='iXldq'></ul>
                • <small id='iXldq'></small><noframes id='iXldq'>

                  1. <legend id='iXldq'><style id='iXldq'><dir id='iXldq'><q id='iXldq'></q></dir></style></legend>

                      <i id='iXldq'><tr id='iXldq'><dt id='iXldq'><q id='iXldq'><span id='iXldq'><b id='iXldq'><form id='iXldq'><ins id='iXldq'></ins><ul id='iXldq'></ul><sub id='iXldq'></sub></form><legend id='iXldq'></legend><bdo id='iXldq'><pre id='iXldq'><center id='iXldq'></center></pre></bdo></b><th id='iXldq'></th></span></q></dt></tr></i><div id='iXldq'><tfoot id='iXldq'></tfoot><dl id='iXldq'><fieldset id='iXldq'></fieldset></dl></div>
                      <tfoot id='iXldq'></tfoot>