ios - 以编程方式调用电话

如何在 iPhone 上以编程方式调用电话?我尝试了以下代码,但没有任何反应:

NSString *phoneNumber = mymobileNO.titleLabel.text;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

最佳答案

要返回原始应用程序,您可以使用 telprompt://而不是 tel://- tell 提示符将首先提示用户,但当调用完成后,它将返回您的应用程序:

NSString *phoneNumber = [@"telprompt://" stringByAppendingString:mymobileNO.titleLabel.text];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];

https://stackoverflow.com/questions/4929717/

相关文章:

ios - 较小时 UIScrollView 的中心内容

iphone - 如何在 Objective-C 2.0 中将方法标记为已弃用?

objective-c - NSInvocation 傻瓜?

ios - iPhone SDK : what is the difference between

objective-c - Swift References 中的 _ 下划线代表什么?

ios - 如何设置一个简单的委托(delegate)来在两个 View Controller 之间

objective-c - "FOUNDATION_EXPORT"与 "extern"

ios - 使用 AVFoundation AVPlayer 循环播放视频?

ios - UIView 隐藏/显示动画

iphone - 从实例中获取类的名称