How to Get Imei on Iphone

How to get IMEI number of iPhone programmatically?

You can get the UDID, but can not get the IMEI.Apple does not allow this.

How to get IMEI on iPhone?

You can't get IMEI on iPhone anymore. You may have to use UDID instead. See other answers.


In the past, you could use the header file "Message/NetworkController.h" posted on ericasadun.com.
http://ericasadun.com/iPhoneDocs300/_network_controller_8h-source.html (It's been removed now)

You would add the NetworkController.h file and the private framework "Message.framework" to your project, then import that header file to use the original method I found to get the imei number:

NetworkController *ntc = [NetworkController sharedInstance];
NSString *imeistring = [ntc IMEI];

That hack doesn't work anymore. App will be rejected by Apple.

Getting real iPhone device IMEI on Xamarin.Forms

This is no longer possible: https://forums.developer.apple.com/thread/31122

In general, iOS does not let you get at persistent unique identifiers
(the IMEI, the UDID, the Wi-Fi MAC address, and so on).

Alternate to IMEI

There are a few alternatives to the IMEI or MAC address that Apple now provide.

One such is [[UIDevice currentDevice] identifierForVendor].

From Apple's documentation.

An alphanumeric string that uniquely identifies a device to the app’s vendor.
The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.

There is another alternative which, if you're implementing a system to serve advertisements, you need to use [ASIdentifierManager advertisingIdentifier] according to their documentation.

I find that identifierForVendor is usually enough to implement a security layer, especially when you have a server side component that maintains a list of users and identifiers used.

You can also generate a UUID off of the identifierForVendor as seen below.

Objective-C:

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

Swift 3:

let generateUUID = UIDevice.current.identifierForVendor?.uuidString

This should absolutely be enough for what you require.

Finding IMEI number using Objective-C

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.



Related Topics



Leave a reply



Submit