iOS - 私有API - 接听来电 [英] iOS - private API - accept incoming phone call

查看:147
本文介绍了iOS - 私有API - 接听来电的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过私有API以编程方式接听/接听来电?

Is it possible to accept/answer an incoming phone call programmatically via a private API?

我试用了代码来阻止我该怎么办?使用私有API来阻止iOS应用程序中的传入呼叫?。最终,我得到它为iOS 6构建。

I tried out the code to block an incoming call referenced at How can I use private APIs to block incoming calls in an iOS application?. Eventually, I got it to build for iOS 6.

也许一个难点是一旦呼叫到达,自己的应用程序就会进入后台?或者是否有应用程序可以在此之前收到的事件?

Maybe one difficulty is that the own app goes to the background as soon as a call arrives? Or is there an event the app can receive before that?

推荐答案

我明白了:你必须使用 CTCallAnswer(电话); 在以下通知案例中:

I got it: You have to use CTCallAnswer(call); in the following notification case:

if ([str1 isEqualToString:@"kCTCallIdentificationChangeNotification"])
{
    NSDictionary *info = (__bridge NSDictionary *)userInfo;
    CTCall2 *call = (__bridge CTCall *)[info objectForKey:@"kCTCall"];
    NSString *caller = CTCallCopyAddress(NULL, call);
    NSLog(@"Caller %@",caller);

    // answer this call
    CTCallAnswer(call);
}

这篇关于iOS - 私有API - 接听来电的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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