xcode 以编程方式获取 iOS7 的 IMEI

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18927744/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:51:10  来源:igfitidea点击:

Get IMEI for iOS7 programmatically

iosxcodeios7xcode5imei

提问by Carlos Aguirre Tradeco

in XCode 4.6, iOS 6.1, we use CoreTelephony to obtain IMEI, the same way mentioned in get IMEI on iPhone with CoreTelephony?question, but after switching to iOS7 and XCode 5 it doesn't work anymore. My system considers IMEI as an unbreakable way to identify a cellphone and guarantee it is linked to a specific user, also other security issues depend on this identifier. With the new iOS the code is not working and we hadn't found a way to obtain it.

在 XCode 4.6、iOS 6.1 中,我们使用 CoreTelephony 获取 IMEI,与使用 CoreTelephony在 iPhone 上获取 IMEI 中提到的方法相同问题,但在切换到 iOS7 和 XCode 5 后,它不再起作用了。我的系统认为 IMEI 是一种牢不可破的方式来识别手机并保证它与特定用户相关联,其他安全问题也取决于此标识符。在新的 iOS 中,代码不起作用,我们还没有找到获取它的方法。

My central question is: What options do I have to obtain IMEI in iOS7 / XCode 5?

我的中心问题是:在 iOS7/XCode 5 中我有哪些选择来获取 IMEI?

Variations are: - How else could I guarantee a cellphone belongs to a specific person? Identity is very important in my system and ownership of device is a requisite. - What other options do we have to keep secure the system without the need to rewrite too much?

变化是: - 我还能如何保证手机属于特定的人?身份在我的系统中非常重要,设备的所有权是必要条件。- 我们还有什么其他选择来保证系统安全而不需要重写太多?

采纳答案by user2175843

Unless there is a private API solution found - our organization is moving forward with placing the IMEI and phone# into our Enterprise Applications as a guarded Application Settings.

除非找到私有 API 解决方案 - 我们的组织正在推进将 IMEI 和电话号码作为受保护的应用程序设置放入我们的企业应用程序中。

With the new camera based barcode recognition of iOS7 - the IMEI can even be scanned from the phone box during initial kitting and deployment rather than entered by hand.

借助 iOS7 新的基于摄像头的条码识别 - IMEI 甚至可以在初始装备和部署期间从手机盒中扫描,而不是手动输入。

We also considered tracking the identifierForVendor UUID in a database etc. linking to IMEI/Phone# but since it can change and since our historical data is all IMEI based - didn't make sense to add that layer of tracking complexity to a semi-useless identifier that doesn't trace back to a universal meaningful tracking mechanism like Phone/IMEI.

我们还考虑在链接到 IMEI/Phone# 的数据库等中跟踪 identifierForVendor UUID,但由于它可以更改,而且由于我们的历史数据都是基于 IMEI 的 - 将跟踪复杂性添加到半无用层是没有意义的无法追溯到通用有意义的跟踪机制(如电话/IMEI)的标识符。

回答by qwiboo

You should not be getting IMEI in first place as you're using private API and this is against Apple rules.

您不应该首先获得 IMEI,因为您使用的是私有 API,这违反了 Apple 规则。

To get unique identifier for device you should use identifierForVendor method. This will always return the same id across all your apps running on the same phone. See apple docs for more detail.

要获取设备的唯一标识符,您应该使用 identifierForVendor 方法。这将始终在同一部手机上运行的所有应用程序中返回相同的 ID。有关更多详细信息,请参阅苹果文档。

回答by Christian Seiler

Use the identifierForVendorto get "an alphanumeric string that uniquely identifies a device to the app's vendor. (read-only)".

使用identifierForVendor来获取“唯一标识应用程序供应商设备的字母数字字符串。(只读)”。

The method is described in the UIDevice Class Reference.

UIDevice 类参考中描述了该方法。

回答by Ram G.

I am not very sure about IMEI number. in iOS7 Apple changed the way they provide the Unique Identifier. They have also stopped providing MAC address of the wifi card. Now they provide a Unique Identifier for Each Device and App Vender. Please see iOS 7 release notes. You may want to use that Unique Identifier.

我不太确定 IMEI 号码。在 iOS7 中,Apple 改变了他们提供唯一标识符的方式。他们也停止提供wifi卡的MAC地址。现在,他们为每个设备和应用程序供应商提供唯一标识符。请参阅 iOS 7 发行说明。您可能想要使用该唯一标识符。

回答by Lukasz Czerwinski

You could use advertisingIdentifierwhich is unique to each device. See: Apple documentation.

您可以使用advertisingIdentifier每个设备独有的功能。请参阅:Apple 文档。

As far as I can tell, advertisingIdentifierand identifierForVendorare the only 2 unique identifiers you could use.

据我所知,advertisingIdentifier而且identifierForVendor你可以使用只有2唯一标识符。