Uniquely identifying an iOS user

后端 未结 10 1906
小蘑菇
小蘑菇 2020-12-02 12:27

I\'d like to create a user account on the server for new users of an app, but I\'d also like to not ask the user to type in anything. Ideally, I\'d like this to be automatic

10条回答
  •  不思量自难忘°
    2020-12-02 13:14

    Generating a UUID like Erik suggested is definitely a solid solution. The only (small) caveat might be that in the event of a full iDevice restore, the keychain will be wiped too. The application will generate a new UUID in this scenario and the iDevice cannot be related to an existing user anymore.

    Another approach to uniquely identify an iDevice is to generate a unique id based on the MAC address of the network interface and combine it with the app bundle id. This methods yields a unique id that is application specific and durable. It will not change when the iDevice is wiped, restored or when the app is removed and reinstalled. Because of this, there is no need to store this id in the keychain.

    Fortunately there are already some people that have created a little library to achieve this. The code can be found on GitHub:

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

提交回复
热议问题