本文介绍了从iPhone应用程序拨打电话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过我的iPhone应用程序拨打给定号码的电话。你能建议一个最好解释它的好教程或告诉我这个过程吗?
I want to make a phone call on given number from my iPhone application. Could you suggest any good tutorial which explains it the best or tell me the process?
推荐答案
NSString* phoneNumber=TextFiled Name
NSString *number = [NSString stringWithFormat:@"%@",phoneNumber];
NSURL* callUrl=[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",number]];
//check Call Function available only in iphone
if([[UIApplication sharedApplication] canOpenURL:callUrl])
{
[[UIApplication sharedApplication] openURL:callUrl];
}
else
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"ALERT" message:@"This function is only available on the iPhone" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
这篇关于从iPhone应用程序拨打电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!