Removed long running operations support as I don't think we need it.

This commit is contained in:
Maurice Parker 2020-04-02 14:13:57 -05:00
parent ef6a79489a
commit f97194b9be
2 changed files with 0 additions and 19 deletions

View File

@ -423,7 +423,6 @@ final class CloudKitAccountDelegate: AccountDelegate {
}
zones.forEach { zone in
zone.resumeLongLivedOperationIfPossible()
zone.subscribe()
}
}

View File

@ -46,20 +46,6 @@ extension CloudKitZone {
return CKRecord.ID(recordName: UUID().uuidString, zoneID: Self.zoneID)
}
func resumeLongLivedOperationIfPossible() {
guard let container = container else { return }
container.fetchAllLongLivedOperationIDs { (opIDs, error) in
guard let opIDs = opIDs else { return }
for opID in opIDs {
container.fetchLongLivedOperation(withID: opID, completionHandler: { (ope, error) in
if let modifyOp = ope as? CKModifyRecordsOperation {
container.add(modifyOp)
}
})
}
}
}
func subscribe() {
let subscription = CKRecordZoneSubscription(zoneID: Self.zoneID)
@ -173,10 +159,6 @@ extension CloudKitZone {
func modify(recordsToSave: [CKRecord], recordIDsToDelete: [CKRecord.ID], completion: @escaping (Result<Void, Error>) -> Void) {
let op = CKModifyRecordsOperation(recordsToSave: recordsToSave, recordIDsToDelete: recordIDsToDelete)
let config = CKOperation.Configuration()
config.isLongLived = true
op.configuration = config
// We use .changedKeys savePolicy to do unlocked changes here cause my app is contentious and off-line first
// Apple suggests using .ifServerRecordUnchanged save policy
// For more, see Advanced CloudKit(https://developer.apple.com/videos/play/wwdc2014/231/)