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