1.加入一个Framework(CoreTelephony.framework).2.引入头文件#import <CoreTelephony/CTTelephonyNetworkInfo.h>#import <CoreTelephony/CTCarrier.h>3.初始化
# import <UIKit/UIKit.h># import <CoreTelephony/CTTelephonyNetworkInfo.h># import <CoreTelephony/CTCarrier.h>@interface RootViewController : UITableViewController{//声明变量CTTelephonyNetworkInfo *networkInfo;}@end@implementation RootViewController- ( void )viewDidLoad{[ super viewDidLoad];self.navigationItem.prompt = @ "CTTelephonyNetworkInfo" ;self.navigationItem.title = @ "CTCarrier" ;//初始化networkInfo = [[CTTelephonyNetworkInfo alloc] init];//当sim卡更换时弹出此窗口networkInfo.subscriberCellularProviderDidUpdateNotifier = ^(CTCarrier *carrier){UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@ "Sim card changed" delegate:nil cancelButtonTitle:@ "Dismiss" otherButtonTitles:nil];[alert show];};
}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{//获取sim卡信息CTCarrier *carrier = networkInfo.subscriberCellularProvider;static NSString *CellIdentifier = @ "Cell" ;UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil) {cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];}switch (indexPath.row) {case 0 : //供应商名称(中国联通 中国移动)cell.textLabel.text = @ "carrierName" ;cell.detailTextLabel.text = carrier.carrierName;break ;case 1 : //所在国家编号cell.textLabel.text = @ "mobileCountryCode" ;cell.detailTextLabel.text = carrier.mobileCountryCode;break ;case 2 : //供应商网络编号cell.textLabel.text = @ "mobileNetworkCode" ;cell.detailTextLabel.text = carrier.mobileNetworkCode;break ;case 3 :cell.textLabel.text = @ "isoCountryCode" ;cell.detailTextLabel.text = carrier.isoCountryCode;break ;case 4 : //是否允许voipcell.textLabel.text = @ "allowsVOIP" ;cell.detailTextLabel.text = carrier.allowsVOIP?@ "YES" :@ "NO" ;break ;default :break ;} 
     return cell;}
获取手机号码
1.NSString *number = [[NSUserDefaults standardUserDefaults] stringForKey:@"SBFormattedPhoneNumber"];
只能获取的是机主设置的本机号码,不能读取sim卡上的电话号码
2. CTSettingCopyMyPhoneNumber(); 毕竟私有API

ios获取sim卡信息以及手机号码相关推荐

  1. Android开发之获取SIM卡信息和手机号码

    获取SIM卡信息和手机号码的工具类,记录一下方便以后使用 import android.content.Context; import android.telephony.TelephonyManag ...

  2. 获取SIM卡信息的工具类

    本工具类可以获取手机的IMSI.本机的手机号码.SIM卡的服务商. 移动.联通可正常获取到SIM卡的手机卡号,但是电信的获取不到.... 首先,需要在AndroidManifest.xml清单配置文件 ...

  3. IPhone之获取Sim卡信息

    原文地址:IPhone之获取Sim卡信息 作者:飞舞的鸡毛 首先,加入一个Framework. 引入头文件 #import <UIKit/UIKit.h> #import<CoreT ...

  4. android 双卡开发获取sim卡默认数据卡,获取sim卡信息,sim1卡,sim2卡 2G/3G/4G信号强度

    1:默认数据卡 private int getDefalutDataID(){SubscriptionManager subscriptionManager = (SubscriptionManage ...

  5. Android如何获取SIM卡信息

    android 获取sim卡运营商信息 TelephonyManager tm = (TelephonyManager)Context.getSystemService(Context.TELEPHO ...

  6. Android 获取SIM卡信息

    android 获取sim卡运营商信息 TelephonyManager tm = (TelephonyManager)Context.getSystemService(Context.TELEPHO ...

  7. 安卓系统根据SIM卡槽ID获取SIM卡信息

    导入一个包: import android.telephony.SubscriptionManager; 声明变量: SubscriptionManager mSubscriptionManager ...

  8. android 获取sim卡信息list_提醒:手机要设置SIM卡密码!如何设置?有何用处?攻略来了...

    近期,一篇标题为<一部手机失窃而揭露的窃取个人信息实现资金盗取的黑色产业链>的文章引发关注和热议,不法分子偷盗个人手机后,在某政务App窃取用户个人信息,进而申请网贷消费造成用户财产损失的 ...

  9. Android开发之获取手机SIM卡信息

    TelephonyManager是一个管理手机通话状态.电话网络信息的服务类,该类提供了大量的getXxx(),方法获取电话网络的相关信息. TelephonyManager类概述: 可用于访问有关设 ...

最新文章

  1. app息屏后ajax请求不执行_息屏时钟app下载-息屏时钟软件下载v1.0 安卓版
  2. sublime text 的小细节设置,让你的代码更优美
  3. 华为申请注册小艺商标,该商标多品类已被注册
  4. 计算机科学与技术学了会秃头吗,计算机科学与技术vs 信息与计算科学,秃头专业了解一下?...
  5. Query 中使用 text() 或者 html() 函数可bai以获取font or td 的内容:
  6. C++ 函数需要有返回值,但非全分支return(RVO)
  7. 如何处理出差或放假在家办公加密文件打不开?
  8. Java文件上传之断点续传解决方案
  9. win10设置HTML桌面背景,win10系统分屏设置不同壁纸教程
  10. 20金融学431考研应该注意些什么
  11. Android开发方向,我们如何选择?
  12. 计算机图形学 :中点画圆法
  13. Codeforces Round 863 B Kayaking 贪心
  14. 即将毕业大学生的第一个五年计划
  15. 量化框架backtrader之一文读懂可视化
  16. VC++开发RTX拨打电话插件
  17. GalaxyOJ-636 (概率DP)
  18. Excel一个图中设置两个纵坐标
  19. OLED显示图像和波形
  20. 实习生、应届生、三方协议、实习协议、劳动合同的区别

热门文章

  1. 微信小程序云开发微信支付、订单查询、申请退款
  2. Python 给下载文件显示进度条和下载时间(一看就会!)
  3. 高精度卫星图如何免费海量下载
  4. 大学python考试试题_大学Python程序题题库
  5. rollup 压缩插件 rollup-plugin-terser 在 rollup 3.x 不能使用了吗? 跳坑记
  6. python画图没有线_python画图吐血大集合
  7. iOS换一种思路写一个无限轮播的滚动视图
  8. 用于表示盒子的html标记是,1 | 运维开发应该掌握的 HTML 常用标签
  9. 二进制部署K8S多Master+LB负载均衡群集+K8S日志排错
  10. 求问:培训机构让我把简历包装成有1-2年工作经验,怎么办?