如何授予discoverUserInfoWithUserRecordID权限? [英] How to grant discoverUserInfoWithUserRecordID permission?

查看:118
本文介绍了如何授予discoverUserInfoWithUserRecordID权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要通过CloudKit检索实际登录的iCloud用户信息,我需要调用 discoverUserInfoWithUserRecordID 方法。

To retrieve actual logged in iCloud user's info via CloudKit, I need to call the discoverUserInfoWithUserRecordID method.

其API表示:


用户必须为此
容器授予
CKApplicationPermissionUserDiscoverability权限。

The user must have granted the CKApplicationPermissionUserDiscoverability permission for this container.

它是如何工作的?

推荐答案

var defaultContainer = CKContainer.defaultContainer()
var publicDatabase = defaultContainer.publicCloudDatabase
defaultContainer.requestApplicationPermission(.PermissionUserDiscoverability, {status, error in 

})

异步地从用户请求指定的权限。

Requests the specified permission from the user asynchronously.

首次在用户的任何设备上请求权限时,系统会提示用户批准或拒绝该请求。用户授予或拒绝许可后,后续的对同一许可的请求(在相同或单独的设备上)不会再次提示用户。
此方法异步运行,并将结果传递到您提供的块中。

The first time you request a permission on any of the user’s devices, the user is prompted to grant or deny the request. Once the user grants or denies a permission, subsequent requests for the same permission (on the same or separate devices) do not prompt the user again. This method runs asynchronously and delivers the results to the block you provide.

这篇关于如何授予discoverUserInfoWithUserRecordID权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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