Finding IMEI number using Objective-C
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:
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.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.
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.