Finding IMEI number using Objective-C [duplicate]
Asked Answered
K

5

52

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?

Kendo answered 12/11, 2013 at 10:50 Comment(4)
UDID is deprecated. What is your solution ?Kendo
instead of UDID you can use identifier for vendors. (developer.apple.com/library/ios/documentation/uikit/reference/…) Ref.#4270700Crat
I read the description, and i don't think it can be use to uniquely identify a device. A different value is returned for apps on the same device that come from different vendors,...Kendo
Apple don't want you to uniquely identify devices. You can't beat the system.Impalpable
W
80

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.

Wintertide answered 12/11, 2013 at 11:0 Comment(11)
@sharonHwk No, Apple does not longer allow you to identify a unique device.Wintertide
now if you use the advertisingIdentifier but your app doesn't have ad. then your app may be rejected by Apple.Impetus
Pray for identifierForVendor. Apple, do not deny it!Authorized
Good answer, but Any Solution for the Actual question.Leveridge
@ParthPandya the fact that Apple does not allow it means that this is the answer. Unless you are developing for jailbroken devices, but since I have no experience with this I can answer it.Wintertide
@RayKing mind your language. Also Apple has very good reasons for this. Mainly privacy, Apple does what ever it can to protect the users privacy. This include any type of device identification. Thus protecting the users privacy better then any other platform.Wintertide
but it still unfair to developers. what if I want to ban user from using my app? They will delete the app and create new account and keep spamming. not cool..Thatcher
You can still store some unique identifier in the keychain which only your app can access. You can then still block this user. Even better that most user share there keychain with their other devices. Also what if you locked out a device and then the user sells their device the new user can't use you app. This is why identifying device is not correct.Wintertide
Personally, I think this is ridicolous. The issue here is that this only hinders "good" developers and does little to stop the real problem, i.e. the ones who abuse/misuse this information.Disturbance
I want to use IMEI or IMSI number for an app which will be used only internally by my company for testing purposes. This app will not be on the App Store for public distribution. Is there a possibility to get IMEI or IMSI for this internal purpose and not for public distribution?Linter
NSString *UDIDString = [[[UIDevice currentDevice] identifierForVendor] UUIDString];Ilarrold
T
17

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.

Trass answered 12/11, 2013 at 11:7 Comment(2)
According to a couple of blog posts I found, it's not OK to use the advertisingIdentifier for non-advertising purposes. E.g. Pixtant has been rejected twice for not showing ads: moneyfromapps.com/… - Apple's clause for rejection: “You and Your Applications (and any third party with whom you have contracted to serve advertising) may use the Advertising Identifier, and any information obtained through the use of the Advertising Identifier, only for the purpose of serving advertising. [...]”Madid
Actually, every time I release an app on the store, there are tick boxes for ADID, and a comment from Apple that they will remove the app and hold me personally liable if I lie about it.Hygrograph
H
7

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];
Henslowe answered 12/11, 2013 at 11:3 Comment(1)
Since iOS 7, this will give you a dummy UDID beginning with FFFFFFFF.Felker
E
1

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

Embarrassment answered 26/9, 2019 at 15:17 Comment(0)
E
0

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.

Esdraelon answered 12/11, 2013 at 11:4 Comment(1)
using private api (IOKit) will be possible to get IMEI of the device ?Eyelash

© 2022 - 2024 — McMap. All rights reserved.