How to obtain the unique identifier of an ios device

Source: Internet
Author: User

How to obtain the unique identifier of an ios device

A unique identifier is required in many places.

For example:

1. We use the unique identifier of a device as the user ID, especially for online games. This saves the trouble of registration.

2. I want to encrypt app-related files. Where does the key come from? Some may say hard code, but the key of hard code is easy to crack. Files encrypted with the hard code key can be copied to other devices. For example, if a local game File Stores game-related data, you can copy the local file to other devices as long as a machine buys 100 gold coins, other devices can also have 100 gold coins, because all devices use the same hard code key.


If we can obtain a unique identifier of a device, such as an id, we can use this id as the user name or directly use this id as the key. This will be much better. For example, the local files of the game are unique. Even if the files are copied to other devices, others cannot use them because the keys are different.


The previous iphone can obtain the device's udid, which is very simple:

[UIDevice currentDevice] uniqueIdentifier] 
But Apple later banned it. (If you remember correctly, it should have been disabled since ios5)

It is useless now.


I checked it online and found a solution on github,

Https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5

The basic principle is to read the mac address of the wifi chip and convert it into a hash value.

I tried it and it is feasible. I used ios skd 8.


I don't know if Apple will disable the mac address.

Therefore, the best way is to first use the above method to obtain, if the failure, add an error processing, for example, using hard code to obtain other generation id methods.




Help: What is unique in ios to identify a program?

I don't know where to use it
At the file level, each application exists in the form of a sandbox Directory, which is a randomly generated folder name similar to the following
D103006C-6807-4A40-AA9A-8564C7CEBB09
In an application, Bundle identifier is used to identify the unique program and match the app id of Provisioning profiles.
 
How can I obtain a fixed unique identifier code of an IMEI mobile phone?

The mac address of the Wi-Fi device should be unique.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.