从iPhone应用程序拨打电话 [英] Make calls from iPhone app

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

问题描述


可能重复:

从我的应用程序拨打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应用程序拨打电话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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