由于ZoneOptions被弃用,我将optionsByRecordZoneID变量改为ZoneConfiguration如下

   var optionsByRecordZoneID = [CKRecordZone.ID: CKFetchRecordZoneChangesOperation.ZoneConfiguration]()

   for zoneID in zoneIDs {
            let options = CKFetchRecordZoneChangesOperation.ZoneConfiguration()
            options.previousServerChangeToken = settings.getChangeToken(forKey: databaseTokenKey)
            optionsByRecordZoneID[zoneID] = options
        }

现在,我得到这行optionsByRecordZoneID变量的以下错误,
let fetchRecordZoneChangesOperation = CKFetchRecordZoneChangesOperation(recordZoneIDs: zoneIDs, optionsByRecordZoneID: optionsByRecordZoneID)

无法转换类型为“[CKRecordZone.ID:
CKFetchRecordZoneChangesOperation.ZoneConfiguration]'应为'
参数类型“[CKRecordZone.ID:
CKFetchRecordZoneChangesOperation.ZoneOptions]?'
如有任何帮助,我们将不胜感激。

最佳答案

也不推荐使用init(recordZoneIDs:,optionsByRecordZoneID:),因为它使用旧的ZoneOptions
使用init(recordZoneIDs:,configurationsByRecordZoneID:)

let fetchRecordZoneChangesOperation = CKFetchRecordZoneChangesOperation(recordZoneIDs: zoneIDs, configurationsByRecordZoneID: optionsByRecordZoneID)

关于ios - 无法将ZoneConfiguration转换为ZoneOptions,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55185442/

10-12 07:16