我的应用程序的视图控制器中有呼叫按钮。当我单击呼叫按钮时,它将显示我的iPhone呼叫键盘和一些号码。我对此没有任何解决方案。请帮我。
谢谢
在您认为我之前,我不是Popeye
提供其他答案的人。
一直到我的答案。有两种方法可以做到这一点
// Pick one of the two ways from below, one will return you to the app afterwards the other will not.
// This version of of creating the number will open the dialer but will not return you to the app afterwards.
NSURL *phoneNumber = [NSURL urlWithString:[NSString stringWithFormat:@"tel://%@", yourNumberString]];
// Whilst this version will return you to your app once the phone call is over.
NSURL *phoneNumber = [NSURL urlWithString:[NSString stringWithFormat:@"telprompt://%@", yourNumberString]];
// Now that we have our `phoneNumber` as a URL. We need to check that the device we are using can open the URL.
// Whilst iPads, iPhone, iPod touchs can all open URLs in safari mobile they can't all
// open URLs that are numbers this is why we have `tel://` or `telprompt://`
if([[UIApplication sharedApplication] canOpenURL:phoneNumber]) {
// So if we can open it we can now actually open it with
[[UIApplication sharedApplication] openURL:phoneNumber];
}
希望这对您有任何问题的帮助,请问一下。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句