How to obtain a unique ID for an iOS device

Source: Internet
Author: User

There are a lot of places where you'll need a unique logo.

Like what:

1. We use the unique logo of a device as the user ID, especially the online game, so you can save the trouble of registration.

2. Want to encrypt the app-related files, where does the key come from? Some people might say hard code, but tough code keys are easier to crack. And the hard code key encryption file can be copied to other devices. For example, the game's local files save some game-related data, so as long as there is a machine to buy 100 gold coins, then you can copy the local files to other devices, other devices can also have 100 gold, because all the device with the same hard code key.


If we can get the device's unique identity such as an ID, then we can use this ID as the username, or use this ID as the key directly. That would be much better. For example, the game local files are unique, even if the copy to other devices, others can not use, because the key is not the same.


The previous iphone was udid to get the device, very simple:

But then Apple banned it. (If not mistaken, it should be from the beginning of ios5 can not be used)

It's not going to work anyway.


Look it up on the Internet, find a way 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 then convert it into a hash value.

Experiment, it works, I use iOS SKD 8


I wonder if Apple will forbid the MAC address.

So the best way is to use the above method to obtain, if failed, add an error handling, such as the use of hard code to obtain other ways to generate the ID.



How to obtain a unique ID for an iOS device

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.