/*

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卡信息的更多相关文章

  1. ios开发获取SIM卡信息

    .加入一个Framework(CoreTelephony.framework). .引入头文件 #import<CoreTelephony/CoreTelephonyDefines.h> ...

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

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

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

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

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

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

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

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

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

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

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

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

  8. 获取sim卡序列号

    //获取sim卡序列号TelephoneManager TelephonyManager manager = (TelephonyManager)getSystemService(Context.TE ...

  9. SIM卡信息的管理

    MTK平台上,所有插入到手机中的SIM卡的信息都会存储在数据库com.android.providers.telephony中. 原始的数据库 图表 1 SimInfo数据表的结构 从上图示中,我们可 ...

随机推荐

  1. [Javascript] MetaProgramming: new.target

    new.target is a new “magical” value available in all functions, thoughin normal functions it will al ...

  2. 关于Opengl中将24位BMP图片加入�一个alpha通道并实现透明的问题

    #include <windows.h>#include <GL/glut.h>#include <GL/glaux.h>#include <stdio.h& ...

  3. JAVA中toString方法的作用(转)

    因为它是Object里面已经有了的方法,而所有类都是继承Object,所以“所有对象都有这个方法”. 它通常只是为了方便输出,比如System.out.println(xx),括号里面的“xx”如果不 ...

  4. mysql_convert_table_format 批量修改表引擎

    [root@server-mysql bin]# mysql_convert_table_format --help Conversion of a MySQL tables to other sto ...

  5. android开发之merge结合include优化布局

    merge结合include优化android布局,效果不知道,个人感觉使用上也有很大的局限,不过还是了解一下,记录下来. 布局文件都要有根节点,但android中的布局嵌套过多会造成性能问题,于是在 ...

  6. phpcms 换域名

    修改/caches/configs/system.php里面所有和域名有关的,把以前的老域名修改为新域名就可以了. 进行后台设置->站点管理   对相应的站点的域名进行修改. 更新系统缓存.点击 ...

  7. 1,php概述

    学习了这么久的php,今天就跟着这本书,一章一章的去复习一下php的基础知识,个人理解如下:php是一门编写动态语言的web语言,能编写web语言的有好几种,但是人们都喜欢php,第一,php是开源的 ...

  8. [C# 基础知识系列]专题十六:Linq介绍

    转自http://www.cnblogs.com/zhili/archive/2012/12/24/Linq.html 本专题概要: Linq是什么 使用Linq的好处在哪里 Linq的实际操作例子— ...

  9. innosetup 安装静默安装msi,指定安装路径的方法

    自己看了很久帮助,分号的用法确实不太好用,湿了这个东东估计很多人会用到,发出来给大家参考. Filename: "{app}/msiexec.exe";Parameters: &q ...

  10. UIButton 使用imageEdgeInsets和titleEdgeInsets属性

    现在App的底部栏.侧边栏.顶部栏经常出现一些包含图像和文字的Item,以前用按钮上面添加label和imageView,  想想实在是对资源的浪费..                 图1 — 底部 ...