iOS识别唯一用户

Identifying Unique Users of Your App

 

You should identify a user of your app only when doing so offers a clear benefit to that user. In cases where you only need to differentiate one user of your app from another, iOS provides identifiers that can help you do that. However, if you need a higher level of security, you might need to do more work on your own. For example, an app that provides financial services would likely want to prompt the user for login credentials to ensure that the user is authorized to access a specific account.

Important: When identifying a user, always be transparent about what you intend to do with any information you obtain. It is not acceptable to identify a user so that you can track them surreptitiously.

 

Here are some common scenarios that might require you to identify a user, along with solutions for how to implement them.

  • You want to link a user to a specific account on your server. Include a login screen that requires the user to enter their account information securely. Always protect the account information you gather from the user by storing it in an encrypted form.
  • You want to differentiate instances of your app running on different devices. Use the identifierForVendor property of the UIDevice class to obtain an ID that differentiates a user on one device from users on other devices. This technique does now allow you to identify specific users. A single user can have multiple devices, each with a different ID value.  --区分app在不同设备上的实例。 UIDevice.identifierForVendor 区别多个device上的user(实际上是多个设备上的app实例).这个技术不允许你识别特定的用户,一个单一用户可能有多个设备,每个设备有个不同的ID。----UIDevice.identifierForVendor---这个值可能会变。
  • You want to identify a user for the purposes of advertising. Use the advertisingIdentifier property of the ASIdentifierManager class to obtain an ID for the user.

Because users are allowed to run apps on all of their iOS devices, Apple does not provide a way to identify the same user on multiple devices. If you need to identify a specific user, you must provide your own solution using universally unique IDs (UUIDs), a login account, or some other type of identification system.

posted on 2016-06-01 17:24  cocoabanana  阅读(349)  评论(0编辑  收藏  举报

导航