如何测试IOS设备是否具有电话功能? [英] How do I test if IOS device has telephone capabilities?

查看:130
本文介绍了如何测试IOS设备是否具有电话功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过按下iPhone用户的按钮在我的应用程序中提供电话支持,并显示iPad / iPod Touch用户的电话号码。而不是检测用户具有什么设备,是否有更好的方法来查询硬件以查看它是否具有电话功能?如果iPad 3G有一天打开语音通话,这将继续有效。

I want to offer phone support in my app at the press of a button for iPhone users, and display a phone number for iPad/iPod Touch users. Rather than detecting what device the user has, is there a better way to query the hardware to see if it has telephony capabilities? This would continue to work should iPad 3G one day open up for voice calls.

我知道如何通过UIRequiredDeviceCapabilities键将应用程序限制到设备,但是我我不想限制平台,只是检测能力。

I am aware of how to limit an app to devices through the UIRequiredDeviceCapabilities key, but I'm not looking to restrict platform, just detect capabilities.

推荐答案

检查申请是否可以打开电话号码:

Check if application can open tel url:

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel:+11111"]])
  // device has phone capabilities

这篇关于如何测试IOS设备是否具有电话功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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