如何在CloudKit中获取用户记录?

时间:2016-07-17 17:09:19

标签: ios cloudkit

我可以获取userRecordID,但每当我尝试获取与该ID相关联的记录时,我都会收到错误。有什么建议?代码和错误如下:

def bar(A,B):
    C=A*B
    Co=C.tocoo()
    Ao=A.tocoo()
    r=np.concatenate((Co.row,Ao.row))
    c=np.concatenate((Co.col,Ao.col))
    d=np.concatenate((Co.data,Ao.data))
    return sparse.csr_matrix((d,(r,c)),shape=A.shape)

In [107]: timeit bar(A,B)
1000 loops, best of 3: 1.03 ms per loop

myContainer.fetchUserRecordID { (thisID, thisError) in if let userError = thisError { print("DEBUG: error getting user id; \(userError)") } else { if let userID = thisID { self.publicDatabase.fetch(withRecordID: userID, completionHandler: { (fetchedUser, fetchedError) in if let thisError = fetchedError { print("DEBUG: error getting user record; \(thisError)") }

代码出错,或者我尝试测试版软件的错误(iOS 10,Swift 3& xCode-beta 8.0 beta 2(8S162m)

1 个答案:

答案 0 :(得分:-2)

我需要从publicDatabase更改为privateDatabase。

self.publicDatabase.fetch(withRecordID: userID, completionHandler: { (fetchedUser, fetchedError) in

self.privateDatabase.fetch(withRecordID: userID, completionHandler: { (fetchedUser, fetchedError) in

相关问题