如何在通话后恢复iPhone应用程序 [英] How to resume iPhone app after a Phone Call

查看:153
本文介绍了如何在通话后恢复iPhone应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个iPhone应用程序,我在其中提供一个呼叫功能,用户可以通过该功能呼叫拨打指定号码的呼叫。我可以通过打开的URL实现上述功能。

I am creating an iPhone app in which I am providing a call feature with the help of which a user can call place a call on a specified number. I am able achieve the above feature via open URL.

现在,在完成通话后,我想自动恢复应用程序的执行。虽然用户可以在iOS 4.0中进行快速应用切换。但是我希望这是自动完成的。

Now after completion of the call I want to resume the execution of app automatically. Although a user can make a fast app switch in iOS 4.0. but I want this to be done automatically.

我在TomTom应用程序中看到了相同的行为,但我不确定这个应用程序是如何实现的。

I have seen the same behavior in "TomTom" app but I am not sure how this app has achieved it.

谢谢

Sandy

推荐答案

Apple不允许您在通话后恢复应用。你可以尝试做的是使用本地通知。

Apple does not allow you to resume an app after a phone call. What you can however try doing is using a local notification.

调用'call'url处理程序后,你需要启动后台任务并监视调用状态的变化:

After calling the 'call' url handler you will need to start a background task and monitor for a call state change:

CTCallCenter *c=[[CTCallCenter alloc] init];
c.callEventHandler=^(CTCall* call){
  if(call.callState == CTCallStateDisconnected) {
    // do stuff here
  }
}

当您收到呼叫状态更改时,请创建本地通知以提醒用户恢复应用。如果用户点击查看,您的应用程序将出现在前台。显然,如果通话时间超过10分钟,这将不起作用,因为Apple只允许10分钟的后台任务。

When you get a call state change, create a local notification to alert the user to resume the app. If the user taps on "view" your application will then come to the foreground. Obviously if the call is longer than 10 minutes this won't work as Apple only allows 10 minutes to background tasks.

这篇关于如何在通话后恢复iPhone应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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