如何在iPhone 5上获取IMEI [英] How to get IMEI on iPhone 5

查看:713
本文介绍了如何在iPhone 5上获取IMEI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为越狱的iOS设备开发应用程序。我使用 https://github.com/erica/uidevice-extension /blob/master/UIDevice-IOKitExtensions.m 获取IMEI,但在iPhone 5上,此解决方案不起作用(返回空字符串)。有没有办法在iPhone 5(iOS 6.1.2)上获取IMEI?

I'm develop application for jailbroken iOS devices. I use https://github.com/erica/uidevice-extension/blob/master/UIDevice-IOKitExtensions.m to get IMEI, but on iPhone 5 this solution does not work(return empty string). Is there any way to get IMEI on iPhone 5(iOS 6.1.2)?

推荐答案

有几种方法可以启用IMEI较新的设备

There are several ways to get IMEI on newer devices

1)私有ManagedConfiguration.framework

1) Private ManagedConfiguration.framework

CFStringRef MCCTIMEI()

2)CoreTelephony.framework

2) CoreTelephony.framework

struct CTResult
{
    int flag;
    int a;
};
extern CFStringRef kCTMobileEquipmentInfoIMEI;

void *connection = _CTServerConnectionCreate(kCFAllocatorDefault, NULL, NULL);

NSDictionary *info = nil;
struct CTResult result;
_CTServerConnectionCopyMobileEquipmentInfo(&result, connection, &info);
[info autorelease];    
CFRelease(connection);

NSString* IMEI = (NSString*)info[(NSString*)kCTMobileEquipmentInfoIMEI];

3)liblockdown.dylib

3) liblockdown.dylib

extern CFStringRef kLockdownIMEIKey;

void* connection = lockdown_connect();
NSString* IMEI = [(NSString*)lockdown_copy_value(connection, NULL, kLockdownIMEIKey) autorelease];
lockdown_disconnect(connection);

我遇到了一些问题 MCCTIMEI - 已退回设备启动后清空IMEI。现在我正在使用CoreTelephony解决方案,从来没有遇到任何问题。

I had some problems with MCCTIMEI - returned empty IMEI after device start-up. Now I'm using CoreTelephony solution, never had a problem with it.

更新

在iOS 7上,这些API受 com.apple.coretelephony.Identity.get 权利保护。要访问IMEI(IMSI,电话号码和其他信息),您需要使用布尔值设置为true的权利签名。

On iOS 7 these APIs are protected by com.apple.coretelephony.Identity.get entitlement. To access IMEI (IMSI, phone number and other info) you need to sign your with that entitlement with boolean value set to true.

这篇关于如何在iPhone 5上获取IMEI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆