Ios CloudKit:如何使用CKFetchShareParticipants和CKModifyRecords获取共享URL?

Ios CloudKit:如何使用CKFetchShareParticipants和CKModifyRecords获取共享URL?,ios,swift,icloud,cloudkit,ckshare,Ios,Swift,Icloud,Cloudkit,Ckshare,我正在关注这段代码和一些在线发现的示例代码(遗憾的是,苹果在其WWDC演讲中没有包含示例代码),下面的代码让我的CKShareParticipantok,但是这个blockmodOperation.modifyRecordsCompletionBlock根本没有返回,我做错了什么 private func share(record: CKRecord) { let share = CKShare(rootRecord: record) // s

我正在关注这段代码和一些在线发现的示例代码(遗憾的是,苹果在其WWDC演讲中没有包含示例代码),下面的代码让我的
CKShareParticipant
ok,但是这个block
modOperation.modifyRecordsCompletionBlock
根本没有返回,我做错了什么

 private func share(record: CKRecord) {
        
        let share = CKShare(rootRecord: record)
        // save
        let operation = CKFetchShareParticipantsOperation(userIdentityLookupInfos: [CKUserIdentity.LookupInfo(emailAddress: "friendsEmail@gmail.com")])
        
        var participants = [CKShare.Participant]()
        
        // Collect the participants as CloudKit generates them.
        operation.shareParticipantFetchedBlock = { participant in
           
            participants.append(participant)
        }
        
        // If the operation fails, return the error to the caller.
        // Otherwise, return the array of participants.
        operation.fetchShareParticipantsCompletionBlock = { error in
            
            if let error = error {
                print("error: ", error)
            } else {
            
                for participant in participants {
                    print("we have a participant! = \(participant)")
                    
                    let modOperation: CKModifyRecordsOperation = CKModifyRecordsOperation(recordsToSave: [record, share], recordIDsToDelete: nil)
                    
                    operation.shareParticipantFetchedBlock = { participant in
                        participant.permission = .readOnly
                        share.addParticipant(participant)
                        
                        modOperation.savePolicy = .ifServerRecordUnchanged
                        
                        //nothing in this block gets called
                        modOperation.modifyRecordsCompletionBlock = {records, recordIDs, error in
                            if let error = error {
                                print("error in modifying the records: ", error)
                            } else {
                                print("TESTING records = \(records) recordIDs = \(recordIDs)")
                            }
                            
                        }
                    }
                
                    modOperation.qualityOfService = .userInitiated
                    container.privateCloudDatabase.add(modOperation)
                    
                    
                }   //end of for participant in participants
            }
            
            
            
        } //end of operation.fetchShareParticipantsCompletionBlock
        
        // Set an appropriate QoS and add the operation to the
        // container's queue to execute it.
        operation.qualityOfService = .userInitiated
        container.add(operation) //It was important to make sure this is the same container
    }

这只是一个输入错误,我只需要在
modOperation
的声明下删除这一行
operation.shareParticipantFetchedBlock={participant in