如何使用私有API来阻止iOS应用程序中的传入呼叫? [英] How can I use private APIs to block incoming calls in an iOS application?

查看:140
本文介绍了如何使用私有API来阻止iOS应用程序中的传入呼叫?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够有选择地阻止我正在编写的iOS应用程序中的传入呼叫。这是供个人使用的,而不是App Store,所以我可以使用私有API来实现这一目标。

I would like to be able to selectively block incoming calls in an iOS application I'm writing. This is intended for personal use, not the App Store, so I'm fine with using private APIs to accomplish this.

我最近遇到了核心电话框架。有没有办法使用这个框架来阻止调用?如果没有,我可以使用哪些私有API来执行此操作?

I have recently come across the Core Telephony framework. Is there a way to use this framework to block calls? If not, what private APIs could I use to do this?

推荐答案

您确定不是吗? http://tech.ruimaninfo.com/?p=83代码示例>展示了如何做这些事情。
SDK中的核心电话标头不完整。
当然这意味着没有app store
这是基于我链接的示例的代码片段

Are you sure it does not? code examples on http://tech.ruimaninfo.com/?p=83 shows how to do such things. Core Telephony headers in SDK are not complete. Of course this means no app store this is my code fragment based on example I linked

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

}

需要额外的定义:

typedef struct __CTCall CTCall;
extern NSString *CTCallCopyAddress(void*, CTCall *);
extern void CTCallDisconnect(CTCall*);

你需要监控电话中心的回调(参见链接示例)
我测试了这个片段在我的iOS5设备上

and you need to monitor telephony center's callback(see linked example) I tested this fragment on my iOS5 device

这篇关于如何使用私有API来阻止iOS应用程序中的传入呼叫?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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