为什么找不到iCloud帐户/ CKContainer [英] Why is iCloud account/CKContainer not being found

查看:186
本文介绍了为什么找不到iCloud帐户/ CKContainer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请在下面查看我的更新问题:

Please see my updated question below:

我正在使用CloudKit开发我的第一个应用程序。在尝试查找交易之前,我正在尝试测试用户是否已连接到iCloud。

I am working on my first app with CloudKit. I'm trying to test whether a user is connected to iCloud, before looking for transactions.

这是我的代码(显示各种测试):

This is my code (showing various tests):

func isICloudContainerAvailable()->Bool {

        CKContainer.default().accountStatus { (accountStat, error) in
            if (accountStat == .available) {
                print("iCloud is available")
            }
            else {
                print("iCloud is not available")
            }
        }

        CKContainer.default().accountStatus { (accountStatus, error) in
            switch accountStatus {
            case .available:
                print("iCloud Available")
            case .noAccount:
                print("No iCloud account")
            case .restricted:
                print("iCloud restricted")
            case .couldNotDetermine:
                print("Unable to determine iCloud status")
            }
        }


        if FileManager.default.ubiquityIdentityToken != nil {
            //print("User logged in")
            return true
        }
        else {
            //print("User is not logged in")
            return false
        }
    }

这对于我自己的帐户来说还可以-我可以按预期工作。但是,对于新用户(例如Apple Review团队和我自己的测试用户),我得到

This works ok for my own account -- I can work as expected. However, for new users, (ie Apple Review team and my own test users), I get

iCloud不可用,而
没有iCloud帐户

iCloud Unavailable, and No iCloud Account

我确定有一个开放的iCloud帐户,因为新用户的iCloud邮件正在工作。

I'm sure that there is an open iCloud account as the new user's iCloud mail is working.

更新

我有一个测试用户注销并再次登录。第一次启动应用程序时,她会收到noCloud消息。如果她重新启动该应用程序,则它可以工作。我可以在一些地方使用一些想法。.我已经使用自己的计算机使用新的测试帐户确认了此行为。

I've had a test user log out and log in again. The first time she starts the app, she gets the noCloud messages. If she restarts the app, it works. I could use some ideas on places to look.. I have confirmed this behavior using my own computer with a new test account.

推荐答案

根据文档,


仅当ubiquityIdentityToken属性中的值不为nil时,私有数据库才可用 >。

它也说


有些时候,iCloud可能对您的应用程序不可用,例如,当用户禁用文档和工具时,数据功能或退出
iCloud

文档和数据为现在显然在设置中称为 iCloud Drive 。

Documents and Data is now apparently what is called iCloud Drive in Settings.

所以我问有问题的用户是否启用了他们的iCloud Drive设置以及是否启用会有所不同。

So I would ask the users in question if their iCloud Drive setting is enabled and if turning it on makes any difference.

这篇关于为什么找不到iCloud帐户/ CKContainer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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