向CKContainer请求userIdentity时为什么收到零?

时间:2019-05-16 13:18:35

标签: swift cloudkit

container.fetchUserRecordID { (recordID, error) in
            if let error = error {
                print(error.localizedDescription)
            }
            else{
                guard let recordID = recordID else { return }
                container.discoverUserIdentity(withUserRecordID: recordID, completionHandler: { (userIdentity, error2) in
                    if let error2 = error2{
                        print(error2.localizedDescription)
                    }
                    else{
                        if let userIdentity = userIdentity{
                            identity = userIdentity
                        }
                    }
                })
            }
        }
        return identity
在此代码的

上,在container.discoverUserIdentity上,该代码输入else语句,但是userIdentity为nil,即使错误也为nil。知道为什么吗?

0 个答案:

没有答案