Coder221
Coder221

Reputation: 1433

Cannot convert ZoneConfiguration to ZoneOptions

As ZoneOptions is deprecated, I changed optionsByRecordZoneID variable to ZoneConfiguration as follows

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

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

Now, I am getting the following error for this line for optionsByRecordZoneID variable,

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

Cannot convert value of type '[CKRecordZone.ID : CKFetchRecordZoneChangesOperation.ZoneConfiguration]' to expected argument type '[CKRecordZone.ID : CKFetchRecordZoneChangesOperation.ZoneOptions]?'

Any help in regard to get rid of it would be appreciated.

Upvotes: 0

Views: 199

Answers (2)

Juanjo
Juanjo

Reputation: 734

Just add this entry to state that the accepted answer it is the way to do it in Xcode 10.2. Please take a look at it.

Upvotes: 0

rmaddy
rmaddy

Reputation: 318814

The init(recordZoneIDs:,optionsByRecordZoneID:) is deprecated too since it takes the old ZoneOptions.

Use init(recordZoneIDs:,configurationsByRecordZoneID:).

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

Upvotes: 5

Related Questions