Sorix / CloudCore

Framework that enables syncing between iCloud (CloudKit) and Core Data
MIT License
153 stars 40 forks source link

Bug for fetchAndSave on RecordToCoreDataOperation #7

Closed EvgeniyBruchkovskiy closed 7 years ago

EvgeniyBruchkovskiy commented 7 years ago
2017-09-04 10 59 04

I have a 2 Entity's

2017-09-04 11 00 41

The client is stored normally. Only client, doesn't DateOfRecords. When I save DateOfRecords and fetch or save in cloudKit come about crash.

Please, help me for my question.

P.S. Sorry for my English.

Sorix commented 7 years ago

Any way to provide source code if it is not private to test it? You can send it to my mail with steps to reproduce.

EvgeniyBruchkovskiy commented 7 years ago

Сan show in skype, record from the screen

2017-09-12 23:16 GMT+03:00 Vasily Ulianov notifications@github.com:

Any way to provide source code if it is not private to test it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Sorix/CloudCore/issues/7#issuecomment-328971781, or mute the thread https://github.com/notifications/unsubscribe-auth/AYxu-m1zMfhIObrSXMS0knESWVIf8g0jks5shuakgaJpZM4PLlOv .

Sorix commented 7 years ago

I've checked my code, I can't find some lines in method that had thrown an error in my files. Maybe you're using a fork or some outdated version?

Current version of that method is:

/// Fill provided `NSManagedObject` with data
///
/// - Parameters:
///   - entityName: entity name of `object`
///   - recordDataAttributeName: attribute name containing recordData
private func fill(object: NSManagedObject, entityName: String, serviceAttributeNames: ServiceAttributeNames, context: NSManagedObjectContext) throws {
    for key in record.allKeys() {
        if self.isCancelled { return }

        let recordValue = record.value(forKey: key)

        let attribute = CloudKitAttribute(value: recordValue, entityName: entityName, serviceAttributes: serviceAttributeNames, context: context)
        let coreDataValue = try attribute.makeCoreDataValue()
        object.setValue(coreDataValue, forKey: key)
    }

    // Set system headers
    object.setValue(record.recordID.encodedString, forKey: serviceAttributeNames.recordID)
    object.setValue(record.encdodedSystemFields, forKey: serviceAttributeNames.recordData)
}

There is no is [Any].