问题
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.
My central question is: What options do I have to obtain IMEI in iOS7 / XCode 5?
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?
回答1:
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.
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.
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.
回答2:
You should not be getting IMEI in first place as you're using private API and this is against Apple rules.
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.
回答3:
Use the identifierForVendor
to get "an alphanumeric string that uniquely identifies a device to the app’s vendor. (read-only)".
The method is described in the UIDevice Class Reference.
回答4:
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.
回答5:
You could use advertisingIdentifier
which is unique to each device.
See: Apple documentation.
As far as I can tell, advertisingIdentifier
and identifierForVendor
are the only 2 unique identifiers you could use.
来源:https://stackoverflow.com/questions/18927744/get-imei-for-ios7-programmatically