简体   繁体   English

UIDevice是否具有电话功能? iOS8(可以拨打电话)

[英]UIDevice has phone capability? iOS8 (can make phone call)

I currently use this method in a UIDevice category to easily detect device with phone capability. 我目前在UIDevice类别中使用此方法来轻松检测具有电话功能的设备。 On iOS8 however this does not work any more =( 在iOS8上,这不再起作用=(

+(BOOL)hasPhoneCapability;
{
    return [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel:+11111"]];
}

I suppose that it is because of the new handoff / continuety features introduced in iOS8. 我想这是因为iOS8中引入了新的切换/连续性功能。 That actually lets you answer or place phone calls on your iPad and even your Mac. 实际上,这使您可以在iPad甚至Mac上接听或拨打电话。

I know that I could revert to detecting if the device is specifically an iPhone and settle for that. 我知道我可以恢复检测该设备是否特别是iPhone并为此解决。 But what I would like to accurately test the current device capability. 但是我想准确地测试当前的设备功能。

An iPad that is correctly configured and in proximity to paired iPhone should be detected as a device with phone capability, but not configured / without paired phone it should declare as a device with no phone capability. 应该将已正确配置且与配对iPhone相邻的iPad检测为具有电话功能的设备,但未配置/没有配对电话的iPad应该声明为不具有电话功能的设备。

On iOS 8, it's better to check if your device is iPad or iPod Touch, because with hands off, all device device return YES (simulator return NO) on this test. 在iOS 8上,最好检查您的设备是iPad还是iPod Touch,因为在放开手的情况下,所有设备在此测试中均返回YES(模拟器返回NO)。

Hope Apple correct this in future. 希望苹果将来能纠正这个问题。

That's block hands off capabilities but that work. 那阻碍了传递功能,但是可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM