如何在我的Iphone应用程序中调用呼叫事件?

时间:2011-07-20 10:05:22

标签: iphone objective-c events call contacts

这是场景: 我已将iphone联系人详细信息提取到我的应用程序中。我已经显示了我的View控制器的电子邮件,电话详细信息。 现在,我想知道如何调用我在应用程序中点击电话号码的呼叫事件?

3 个答案:

答案 0 :(得分:4)

嗯,你只需要调用tel方案:

NSURL *phoneURL = [NSURL URLWithString:@"tel:1234564897"];

BOOL hasPhone = [[UIApplication sharedApplication] canOpenURL:phoneURL];

if (hasPhone) {
    [[UIApplication sharedApplication] openURL:phoneURL];
}

Apple URL scheme Reference

答案 1 :(得分:1)

NSString *phoneNumber = @"tel://1234567890"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

答案 2 :(得分:0)

尝试

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://123456789"]];