iPhone 4S上的IMEI空号码 [英] Empty IMEI Number on iPhone 4S

查看:128
本文介绍了iPhone 4S上的IMEI空号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在使用Erica的代码以编程方式获取iPhone IMEI号码: https://github.com/erica/uidevice-extension/blob/master/UIDevice-IOKitExtensions.m

这在iPhone 3G和4,甚至是iOS 5的iPhone 4上也能正常工作.但是,当我在iPhone 4S上尝试使用它时,它返回空.

我当前使用的代码是否需要更新,或者是否有其他方法可以在4S上获取IMEI?

解决方案

最后,由于Apple将限制对唯一标识符(如IMEI和iPhone唯一ID)的访问,我不得不使用一些代码来自Georg Kitz,它根据手机的MAC地址创建一个唯一的标识符,并使用MD5进行哈希处理.

使用Georg Kitz的代码( https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5 ),我可以按照以下方式获取ID:

UIDevice * thisDevice = [UIDevice currentDevice];
thisDevice.uniqueDeviceIdentifier

I'm currently using Erica's code to get hold of the iPhone IMEI number programmatically: https://github.com/erica/uidevice-extension/blob/master/UIDevice-IOKitExtensions.m

This works fine on iPhone 3G and 4, even an iPhone 4 with iOS 5. But when I try it on a iPhone 4S, it returns empty.

Does the code I'm currently using need updating, or is there an alternate method to get the IMEI on the 4S?

解决方案

In the end, due to fact that Apple is going to be restricting access to unique identifiers like the IMEI and the iPhone unique Id, I resorted to using some code from Georg Kitz which creates a unique identifier based on the MAC address of the phone, hashed using MD5.

Using Georg Kitz's code (https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5), I can simply get the Id as follows:

UIDevice * thisDevice = [UIDevice currentDevice];
thisDevice.uniqueDeviceIdentifier

这篇关于iPhone 4S上的IMEI空号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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