ios - iPad 上的 CKErrorNotAuthenticated

标签 ios ipad cloudkit

我尝试获取 userRecordID。在模拟器中它可以工作,但在我的 iPad 上却不行。在 iPad 上,我收到一个 CKErrorDomain"- 代码:9,这意味着 CKErrorNotAuthenticated,即使我之前在 iPad 设置中登录了 iCloud。那我错过了什么?我是否必须以编程方式注册某些内容或在 iPad 中打开某些内容设置?谢谢

if(self.usrRecordID == nil) {
    CKContainer.defaultContainer().fetchUserRecordIDWithCompletionHandler({ userRecordID, error in
        self.stopActivityIndicator()
        if error != nil {
            self.showMsg("Error...", vc: vc)
            return
        } else {
            self.usrRecordID = userRecordID //USRID
        }
    })
} 

最佳答案

执行方法之前:

CKContainer.defaultContainer().fetchUserRecordIDWithCompletionHandler({ userRecordID, error in
    ...
}

您应该调用该方法:

CKContainer.defaultContainer().accountStatusWithCompletionHandler({status, error in
    NSLog("Account status = (status.hashValue) (0=CouldNotDetermine/1=Available/2=Restricted/3=NoAccount)")
})

响应应该是1,如果是3,那么你必须登录iCloud

关于ios - iPad 上的 CKErrorNotAuthenticated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29575949/

相关文章:

ios - 如何找到 Bridging-Header.h 的路径 - Swift,Xcode

iOS 9 iPad 多任务处理 - 并排多任务处理,无需滑过

iphone - 有没有更快的方法来执行 @property 、 @synthesize 和释放类变量?

flutter - 无需登录即可跨设备云数据存储(iCloud、CloudKit)

ios - 将对象附加到变量

iphone - 为 iOS 5 通知中心设置应用程序默认值

ios - iOS Storyboard是否具有相当于工具 :text in android? 的功能

ios - 在 swift 中捕获图像后,ipad 中图像的方向发生变化

swift - 如何对大量入站 CloudKit 通知进行排队

ios - 在 CloudKit 仪表板中创建一个 boolean 字段