iphone获取sim卡信息
-
/*
iphone获取sim卡信息
1.加入一个Framework(CoreTelephony.framework).
2.引入头文件
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
3.初始化
*/
//-----------------------------------
具体demo
//-----------------------------------#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://是否允许voip
cell.textLabel.text = @"allowsVOIP";
cell.detailTextLabel.text = carrier.allowsVOIP?@"YES":@"NO";
break;
default:
break;
}
return cell;
}
iphone获取sim卡信息的更多相关文章
- ios开发获取SIM卡信息
.加入一个Framework(CoreTelephony.framework). .引入头文件 #import<CoreTelephony/CoreTelephonyDefines.h> ...
- Android获取SIM卡信息--TelephonyManager
1>获得TelephonyManager TelephonyManager telMgr = (TelephonyManager) getSystemService(TELEPHONY_SER ...
- Android开发之获取手机SIM卡信息
TelephonyManager是一个管理手机通话状态.电话网络信息的服务类.该类提供了大量的getXxx(),方法获取电话网络的相关信息. TelephonyManager类概述: 可用于訪问有关设 ...
- Android记录3--ExpandableListView使用+获取SIM卡状态信息
Android记录3--ExpandableListView使用+获取SIM卡状态信息 2013年8月9日Android记录 ExpandableListView是一个可以实现下拉列表的控件,大家可能 ...
- Android菜鸟的成长笔记(23)——获取网络和SIM卡信息
TelephonyManager是一个管理手机通话状态.电话网络信息的服务类,该类提供了大量的getXxx()方法来获取电话网络的相关信息.这些信息包括设备编号.软件版本.网络运营商代号.网络运营商名 ...
- MTK Android 读取SIM卡参数,获取sim卡运营商信息
android 获取sim卡运营商信息(转) TelephonyManager tm = (TelephonyManager)Context.getSystemService(Context.TE ...
- 利用电话管理器TelephonyManager获取网络和SIM卡信息
import java.util.ArrayList;import java.util.HashMap;import java.util.Map; import android.os.Bundle;i ...
- 获取sim卡序列号
//获取sim卡序列号TelephoneManager TelephonyManager manager = (TelephonyManager)getSystemService(Context.TE ...
- SIM卡信息的管理
MTK平台上,所有插入到手机中的SIM卡的信息都会存储在数据库com.android.providers.telephony中. 原始的数据库 图表 1 SimInfo数据表的结构 从上图示中,我们可 ...
随机推荐
- oracle本月、上月、去年同月第一天最后一天
select trunc(sysdate, 'month') 本月第一天, trunc(last_day(sysdate)) 本月最后一天, trunc(add_month ...
- the Linux Kernel: Traffic Control, Shaping and QoS
−Table of Contents Journey to the Center of the Linux Kernel: Traffic Control, Shaping and QoS 1 Int ...
- 自主创建tcpdump/wireshark pcap文件
pcap文件格式是bpf保存原始数据包的格式,很多软件都在使用,比如tcpdump.wireshark等等,了解pcap格式可以加深对原始数据包的了解,自己也可以手工构造任意的数据包进行测试. p ...
- table完美css样式,table的基本样式,table样式
table完美css样式,table的基本样式,table样式 >>>>>>>>>>>>>>>>> ...
- Oracle 汉字在不同字符集下所占字节
今天发现了一个问题,一个长度设置为2000字节的字段,插入一条长度为1000的汉字数据,竟然报错了. 一个汉字占两个字节,按理说刚好是2000个字节.但通过查看日志,发现插入数据的长度为3000字节. ...
- <>跟!=
这两个是没有区别的,都是不等于
- Unity3D 关于声音MissingComponentException报错
如果你遇到报错如下: MissingComponentException: There is no 'AudioSource' attached to the "Level-2-bg&quo ...
- declare-styleable:自定义控件的属性
http://www.cnblogs.com/jisheng/archive/2013/01/10/2854891.html 在使用过程中, 1 TypedArray a = getContext() ...
- 写一个最简单的 Server
import java.net.*;import java.io.*;public class Server{ public static void main(String[] args) throw ...
- C#当中的多线程_线程池
3.1 简介 线程池主要用在需要大量短暂的开销大的资源的情形.我们预先分配一些资源在线程池当中,当我们需要使用的时候,直接从池中取出,代替了重新创建,不用时候就送回到池当中. .NET当中的线程池是受 ...