Search code examples
iosiphonephonegap-pluginsimei

Alternate to IMEI


I am going to imei the one who has logged into my application. And I'll give it a special code for security. It just has to be that code and IMEI that can not enter from another phone. What I will do with iOS.They will deal with this code. But, it is no longer possible to get IMEI in iOS. What I will do with iOS. Also, it is no longer possible to mac address in İOS, right?


Solution

  • 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.