简体   繁体   English

iCloud唯一标识符

[英]iCloud unique identifier

I'm trying to learn about iCloud. 我正在尝试了解iCloud。 I've read that there's ubiquityIdentityToken and it's used to determine if iCloud is available or if the user changed the account signed in. Also, this is only available in ios 6+ 我已经读过ubiquityIdentityToken ,它用于确定iCloud是否可用,或者用户是否更改了登录的帐户。此外,这仅适用于ios 6+

But what i need to know is the unique data for every iCloud user. 但我需要知道的是每个iCloud用户的唯一数据。 What i'm saying is, after the user logs into iCloud, is there a way for us developers to know who that persons is/who the account belongs to like a username or id (similar to Facebook's fbid/ identiferForVendor )? 我所说的是,在用户登录iCloud之后,我们的开发人员是否有办法知道该人是谁/谁是该用户所属的用户名或ID(类似于Facebook的fbid / identiferForVendor )? Could we even get the iCloud account of the user in code? 我们甚至可以在代码中获取用户的iCloud帐户吗?

The reason why I want to know this is because i want to check if it's possible to use the user's iCloud account(or whatever unique data we could get from them) as the user's unique identifier on our server. 我之所以想知道这是因为我想检查是否可以使用用户的iCloud帐户(或者我们可以从中获取的任何唯一数据)作为用户在我们服务器上的唯一标识符。

I hope I could get some answers. 我希望我能得到一些答案。 Thank you so much! 非常感谢!

Apple don't want you to do this. Apple不希望你这样做。 That is why they give you a unique token that is opaque. 这就是为什么他们会给你一个不透明的唯一标记。 You can't use it as an id on your server. 您不能将其用作服务器上的ID。 Apple do not allow iTunes accounts to be used in that way at this point in time. Apple目前不允许以这种方式使用iTunes帐户。

I suggest you use your own account names, or you use accounts from Facebook or Twitter, which are accessible via system APIs on iOS. 我建议您使用自己的帐户名,或使用Facebook或Twitter上的帐户,这些帐户可通过iOS上的系统API访问。

You can use CKContainer.fetchUserRecordID(completionHandler:) 你可以使用CKContainer.fetchUserRecordID(completionHandler:)

Returns the user record ID associated with the current user. 返回与当前用户关联的用户记录ID。

https://developer.apple.com/documentation/cloudkit/ckcontainer/1399191-fetchuserrecordid https://developer.apple.com/documentation/cloudkit/ckcontainer/1399191-fetchuserrecordid

This article shows example of practical usage of record ID retrieved in this way: Onboarding without Signup Screens . 本文展示了以这种方式检索的记录ID的实际使用示例: 没有注册屏幕的入职

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM