gpt4 book ai didi

ios - 有没有办法用一个 UICloudSharingController 创建多个 CKShares?

转载 作者:行者123 更新时间:2023-11-28 15:09:35 24 4
gpt4 key购买 nike

对于现在和单个共享,我是这样做的:

//here I have access to record fetched from cloud database
let controller = UICloudSharingController { controller, preparationCompletionHandler in
let share = CKShare(rootRecord: record)
share[CKShareTitleKey] = territory.name as CKRecordValue
share[CKShareTypeKey] = "pl.blueworld.fieldservice" as CKRecordValue
share.publicPermission = .readWrite

let operation = CKModifyRecordsOperation(recordsToSave: [record, share], recordIDsToDelete: nil) //what happens if I pass here a three records and three related ckshares?
operation.savePolicy = .ifServerRecordUnchanged

operation.modifyRecordsCompletionBlock = { records, recordIds, error in
preparationCompletionHandler(share, CloudAssistant.shared.container, error) //how can I do it for every created ckshare?
}

operation.database = territory.database
CloudAssistant.shared.operationQueue.addOperation(operation)
}
controller.delegate = self
controller.popoverPresentationController?.barButtonItem = self.collaborateBarButtonItem
present(controller, animated: true)

但是我怎样才能为 2 ckshares 做这件事呢?可能吗?

最佳答案

当然,在你添加share的地方,你想设置多少就设置多少,例如让 share1 = ...;让 share2 = ...;。然后在 CKModifyRecordsOperation 初始化器中,添加每个共享,例如CKModifyRecordsOperation(recordsToSave: [record1, share1, record2, share2].

关于ios - 有没有办法用一个 UICloudSharingController 创建多个 CKShares?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47891017/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com