如何检测用户是否登录到iCloud? [英] How to detect if a user is signed in to iCloud?

查看:618
本文介绍了如何检测用户是否登录到iCloud?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果用户登录到iCloud,我将如何具体检测 ?检查URLForUbiquityContainerIdentifier的返回值非常有限:

How would I detect specifically if a user is signed into iCloud? Checking the return value of URLForUbiquityContainerIdentifier is very limited:

1)无法区分未登录iCloud的用户和其他情况,例如未启用iCloud. 2)如果用户在游戏仍在后台运行时从设置"应用程序登录iCloud,然后返回该应用程序以尝试访问iCloud服务,似乎并没有改变其行为.

1) It can't distinguish between a user not being signed into iCloud versus other scenarios, e.g. iCloud not enabled. 2) It doesn't appear to change its behavior if a user signs into iCloud from the Settings app while the game is still running in the background, then returns to the app to try to access iCloud services.

是否有更可靠的方法来专门检测用户是否已登录?

Is there a more reliable way to detect specifically if a user is signed in?

推荐答案

此外,从iOS 6开始,还有方法[[NSFileManager defaultManager] ubiquityIdentityToken],它告诉您iCloud是否可用以及用户是否已切换帐户

Also, from iOS 6 on there is the method [[NSFileManager defaultManager] ubiquityIdentityToken], which tells you if iCloud is available and also if the user has switched accounts

这篇关于如何检测用户是否登录到iCloud?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆