.加入一个Framework(CoreTelephony.framework).

.引入头文件

#import<CoreTelephony/CoreTelephonyDefines.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 ://供应商名称(中国联通 中国移动) cell.textLabel.text = @"carrierName"; cell.detailTextLabel.text = carrier.carrierName; break; case ://所在国家编号 cell.textLabel.text = @"mobileCountryCode"; cell.detailTextLabel.text = carrier.mobileCountryCode; break; case ://供应商网络编号 cell.textLabel.text = @"mobileNetworkCode"; cell.detailTextLabel.text = carrier.mobileNetworkCode; break; case : cell.textLabel.text = @"isoCountryCode"; cell.detailTextLabel.text = carrier.isoCountryCode; break; case ://是否允许voip cell.textLabel.text = @"allowsVOIP"; cell.detailTextLabel.text = carrier.allowsVOIP?@"YES":@"NO"; break; default: break; } return cell; }

转自http://blog.sina.com.cn/s/blog_74461f3201018b5x.html

ios开发获取SIM卡信息的更多相关文章

  1. iphone获取sim卡信息

    /* iphone获取sim卡信息 1.加入一个Framework(CoreTelephony.framework). 2.引入头文件 #import <CoreTelephony/CTTele ...

  2. Android获取SIM卡信息--TelephonyManager

    1>获得TelephonyManager  TelephonyManager telMgr = (TelephonyManager) getSystemService(TELEPHONY_SER ...

  3. ios开发-获取手机相关信息

    今天在做客户端的时候,里面有个意见反馈功能. 调用系统带的邮件功能,发送邮件到指定邮箱. 然后我就想,应该在邮件正文部分添加手机相关内容,比如型号,版本,应用程序的版本等等,这样不仅使用者方便,开发者 ...

  4. iOS开发-获取设备型号信息

    开发中有的时候查看设计统计数据,或者通过日志查看错误信息,这个时候我们就需要获取获取设备信息,看下关于设备有几种方法: NSLog(@"%@",[[UIDevice current ...

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

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

  6. Android记录3--ExpandableListView使用+获取SIM卡状态信息

    Android记录3--ExpandableListView使用+获取SIM卡状态信息 2013年8月9日Android记录 ExpandableListView是一个可以实现下拉列表的控件,大家可能 ...

  7. Android菜鸟的成长笔记(23)——获取网络和SIM卡信息

    TelephonyManager是一个管理手机通话状态.电话网络信息的服务类,该类提供了大量的getXxx()方法来获取电话网络的相关信息.这些信息包括设备编号.软件版本.网络运营商代号.网络运营商名 ...

  8. MTK Android 读取SIM卡参数,获取sim卡运营商信息

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

  9. 利用电话管理器TelephonyManager获取网络和SIM卡信息

    import java.util.ArrayList;import java.util.HashMap;import java.util.Map; import android.os.Bundle;i ...

随机推荐

  1. 80-th Level Archeology

    80-th Level Archeology time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  2. UITableView的子控件高度不确定处理

    比如,tableView的tableFootView的控件数量是根据网络请求的数据而定的.那么tableView并不能准确的设置其contentSize.处理方法: 在tableFootView的类中 ...

  3. aX+bY+cZ=n(非负整数解存在性)

    题意: a*1234567+b*123456+c*1234=n 非负整数解得存在性. 题解: 看代码. #include<iostream> #include<cstdio> ...

  4. 用python计算md5,sha1,crc32

    Linux下计算md5sum,sha1sum,crc: 命令 输出 $md5sum hello f19dd746bc6ab0f0155808c388be8ff0  hello $sha1sum hel ...

  5. HDU2181:哈密顿绕行世界问题(DFS)

    哈密顿绕行世界问题 Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Sub ...

  6. Linux学习 -- 软件包管理

    1 软件包类型 源码包 脚本安装包  install.sh  不常用 二进制包(rpm包.系统默认包) RedHat -- rpm包 Debian,Ubuntu -- beb包 2 RPM包命令管理 ...

  7. Modis 陆地产品格网

    Technorati 标签: Modis,陆地产品,格网

  8. ubuntu11.10server 安装redis-2.6.7

    1.下载安装: 1 2 3 4 5 6 cd /tmp wget http://redis.googlecode.com/files/redis-2.6.7.tar.gz tar -zxf redis ...

  9. Hibernate一级缓存和二级缓存深度比较

    1.什么是缓存 缓存是介于应用程序和物理数据源之间,其作用是为了降低应用程序对物理数据源访问的频次,从而提高了应用的运行性能.缓存内的数据是对物理数据源中的数据的复制,应用程序在运行时从缓存读写数据, ...

  10. HDU 3346 Lucky Number

    水题 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> us ...