Finding IMEI number using Objective-C

IosObjective C

Ios Problem Overview


I need to find a way to get the IMEI number of an iPhone device. This question is not a duplicate.

I have gone through several forums including SO, and had no luck finding an answer.

Some say Apple doesn't allow developers to see the IMEI number (SO post), and some say to use UDID instead (SO post). Some say that UDID is deprecated (in iOS 7).

I need to know the following:

1.) Does Apple permit developers to retrieve the IMEI number of the device?

2.) How can i programatically do it?

3.) In case if Apple doesn't allow developers to gather the IMEI number, do they provide any other unique number for the device?

4.) Some suggest to use Telephony framework. If i do so, will apple reject my application?

Ios Solutions


Solution 1 - Ios

Apple does not allow you to identify a device any more.

UDID, MAC address and all other device identifiers are no longer accessible or allowed by Apple.

Apple suggest that you use either UUID (which you will need to store your self or), identifierForVendor or advertisingIdentifier .

Apple is now also rejecting app that use the advertisingIdentifier and not showing any advertisements apps.

Any means to get the IMEI number are using private methods, which is also not allowed by Apple anymore. And your mobile app might/will get rejected because of this.

Solution 2 - Ios

Unfortunately, there is no way to get a unique identifier for a device which will always remain the same. Apple no longer allows you to access the UDID. And in iOS 7, all devices' MAC addresses return the same value, so that is no longer useful either.

However, iOS does now give access to two types of identifiers which can be used to identify a device. They are:

  1. Vendor ID - [UIDevice identifierForVendor]. This is a unique identifier which is the same for all apps from the same vendor or company. It will remain the same, so long as the user has at least one app from the vendor installed on their device. So if you have 3 apps, the vendor ID will remain the same unless the user uninstalls all three apps, and then reinstalls. This is not so useful if you only have one app - if the user deletes it and then reinstalls it, it will change.

  2. Advertiser ID - [UIDevice advertisingIdentifier]. This is a unique identifier meant for advertising purposes. But if you use it for non-advertising purposes they, for the most part, won't care. Under most circumstances, the advertising identifier will not change, even if the user deletes and reinstalls the app. However, there is an option in the iOS settings to reset the advertising identifier, which will change it. This is meant to that users can choose to disassociate themselves from any advertising information which has been collected about them. But this is a very advanced setting and I doubt that many users would do this frequently enough that it would be a problem for you.

Solution 3 - Ios

You can obtain IMEI using private frameworks -See this Question but probably your app will be rejected from app store then.

If you want to obtain some device identifier to use in your application you must use uniqueIdentifier property defined in UIDevice class

(Available in iOS 6.0 and later):

NSString *UDID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

Solution 4 - Ios

You can save UUID in keychain and user it as unique number. It won't change until user will reset iOS.

Solution 5 - Ios

If you want to obtain the IMEI there is no way (on a non-jailbroken device). If you wish to identify the user take a look at this answer. Please pay attention to all documentation/answers written before iOS7 since things have changed.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSharon WatinsanView Question on Stackoverflow
Solution 1 - IosrckoenesView Answer on Stackoverflow
Solution 2 - IosJasonView Answer on Stackoverflow
Solution 3 - IosGuntis TreulandsView Answer on Stackoverflow
Solution 4 - IosえるまるView Answer on Stackoverflow
Solution 5 - IosFr4ncisView Answer on Stackoverflow