Saturday, October 14, 2023
HomeiOS Developmentios - CloudKit fetch Operation recordMatchedBlock is not working

ios – CloudKit fetch Operation recordMatchedBlock is not working


Im attempting fetch data from my personal CloudKit DB.I may capable of fetch the document.I stucked in accessing the fetched document

 func ReadRecord() {
     let predicate = NSPredicate(format: "identify = %@", "samsung")
    let question = CKQuery(recordType: "MobileDetails", predicate: predicate)
    let operation = CKQueryOperation(question: question)
    print("Operation Result's (operation)")
   var objects: [Mobile] = []
    operation.recordMatchedBlock = { (recordID,document) in
                      swap document{
            case .success(let document):
                print("Success Case")
                objects.append(Cell(identify: document["name"] as! String, worth: document["price"]         as! String))
            case .failure(let error):
                print("Error Occured")
            }
                   
    }
   operation.queryResultBlock = { end in
        DispatchQueue.predominant.async{
          self.Array = objects
       }
  }
    privateDatabase.add(operation)
    print("Array depend is (Array.depend)")
    
    
}
That is my operate to fetch a document
The recordmatchedBlock is under no circumstances executing and I am getting solely the empty array within the queryResult block
Additionally tried the question CompletionBlock that too does not work



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments