大佬教程收集整理的这篇文章主要介绍了如何检查设备是否可以打电话(iOS 8)?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
确保在项目中包括“CoreTelephony.Framework”。
在视图控制器中包含以下文件:
#import <CoreTelephony/CTTelephonyNetworkInfo.h> #import <CoreTelephony/CTCarrier.h> - (void)awakeFromNib { // Initialization code if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel://"]]) { // check if iOS Device supports phone calls CTTelephonyNetworkInfo *neTinfo = [[CTTelephonyNetworkInfo alloc] init]; CTCarrier *carrier = [neTinfo subscriberCellularProvider]; NSString *mnc = [carrier mobileNetworkCode]; // User will get an alert error when they will try to make a phone call in airplane mode. if (([mnc length] == 0)) { // Device cAnnot place a call at this time. SIM might be removed. } else { // iOS Device is capable for making calls } } else { // iOS Device is not capable for making calls } if ( ! [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"sms:"]]) { // iOS Device is not capable to send SMS messages. } }
以上是大佬教程为你收集整理的如何检查设备是否可以打电话(iOS 8)?全部内容,希望文章能够帮你解决如何检查设备是否可以打电话(iOS 8)?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。