0
我想从云套件下载多个项目,但我得到的错误“无法指定类型值(CKQueryCursor!,NSError) - >()键入(CKQueryCursor ?, NSError? ) - > void“如何从cloudkit下载多个记录
let locationToLookFor = CLLocation()
let predicate = NSPredicate(format: "location = %@", locationToLookFor as CLLocation)
let query = CKQuery(recordType: "Location", predicate: predicate)
let operation = CKQueryOperation(query: query)
operation.recordFetchedBlock = self.recordFetchBlock
operation.queryCompletionBlock =
{
[weak self]
(cursor: CKQueryCursor!, error: NSError) in
if(cursor != nil)
{
print("Fetching records")
let newOperation = CKQueryOperation(cursor: cursor)
operation.recordFetchedBlock = recordFetchBlock
operation.queryCompletionBlock = operation.queryCompletionBlock
self!.operationQueue.addOperation(newOperation)
}
else {
print("We have fetched all data")
}
}
operationQueue.addOperation(operation)
你关闭有一个隐含展开''cursor''CKQueryCursor,但它应该是可选的''CKQueryCursor我 – Paulw11
的变化@ Paulw11后得到同样的错误!? – Steve