You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my CoreData model there is Consult entity that has mandatory fields for date, moddate (record modification date )and creadate (record creation date). Moddate and creadate are actually determined (together with the uniqueIdentifier) in the awakeFromInsert(), moddate is updated by the willSave() method. A user doesn’t have any way to influence values for creaDate and modDate. Also the date field is mandatory, but app will give an error if the user tries to save without having entered a valid Date. As these 3 fields are mandatory (non optional attributes), CoreData won’t save the record without being present.
Now I have a seemingly rare condition that SyncKit sync is failing because of several but not all Consult records missing these values. So it seems SyncKit is downloading fine, but the CD doesn’t allow saving them. The error I get is (not a ckerror, but an error provided by CD):
Optional(Error Domain=NSCocoaErrorDomain Code=1560 "Multiple validation errors occurred." UserInfo={NSDetailedErrors=(
"Error Domain=NSCocoaErrorDomain Code=1570 \"creaDate is a mandatory value.\" UserInfo={NSValidationErrorObject=<Consult: 0x220058e90> (entity: Consult; id: 0x2afa576b4869e521 <x-coredata://C336B6F2-53BC-4B5D-2EF4-253FB229DBAC/Consult/p11638>; data: <fault>), NSValidationErrorKey=creaDate, NSLocalizedDescription=creaDate is a mandatory value.}",
"Error Domain=NSCocoaErrorDomain Code=1570 \"date is a mandatory value.\" UserInfo={NSValidationErrorObject=<Consult: 0x220058e90> (entity: Consult; id: 0x2afa576b4869e521 <x-coredata:// C336B6F2-53BC-4B5D-2EF4-253FB229DBAC /Consult/ p11638>; data: <fault>), NSValidationErrorKey=date, NSLocalizedDescription=date is a mandatory value.}",
"Error Domain=NSCocoaErrorDomain Code=1570 \"modDate is a mandatory value.\" UserInfo={NSValidationErrorObject=<Consult: 0x220058e90> (entity: Consult; id: 0x2afa576b4869e521 <x-coredata:// C336B6F2-53BC-4B5D-2EF4-253FB229DBAC /Consult/ p11638>; data: <fault>), NSValidationErrorKey=modDate, NSLocalizedDescription=modDate is a mandatory value.}",
"Error Domain=NSCocoaErrorDomain Code=1570 \"creaDate is a mandatory value.\" UserInfo={NSValidationErrorObject=<Consult: 0x27402ca43> (entity: Consult; id: 0x8aea576b4969e591 <x-coredata://B326E632-53BC-4BB3-8E24-2239E889D3EC/Consult/p14562>; data: <fault>), NSValidationErrorKey=creaDate, NSLocalizedDescription=creaDate i is a mandatory value.}",
…
This repeated for about 20 but not all Consult records. These 3 fields and the uniqueIdentifier are the only non-optional fields. But the error only mentions the 3 dates, but not nil for the uniqueIdentifier. So as there is no 1570 error for nil on unqueId I’m assuming it’s not nil, or SyncKit would assign something to it before saving.
I can reproduce the same error by going into Apple’s cloudkit webinterface and manually deleting one of these values (of course I can only do this with the dev account). Then starting a SyncKit sync.
Any idea how it’s possible that -somehow- in iCloud multiple records would have become nil values (for at least these fields, maybe more)? Normally this shouldn’t be possible, but somehow it did. What can be done to avoid this? Could this be caused by a bug in SyncKit?
Of course there is no way for a user to correct this, besides deleting all data in CloudKit and to sync again.
SyncKit v 0.8.0 on iOS 14.3.
In Consult+CoreDataProperties.swift:
override public func awakeFromInsert() {
super.awakeFromInsert()
if uniqueIdentifier == nil {
self.uniqueIdentifier = ProcessInfo.processInfo.globallyUniqueString
self.creaDate = NSDate()
self.modDate = self.creaDate
}
}
override public func willSave() {
super.willSave()
if self.modDate == nil || now.timeIntervalSince(self.modDate! as Date) > 20 {
self.modDate = NSDate()
}
}
Thanks,
Rodge
The text was updated successfully, but these errors were encountered:
Could you have a look at the records before they're uploaded (you can place a breakpoint here) and when they're downloaded (here) ? To get an idea of where the fields are going missing.
Unfortunately I don't have access to the device, only to the errorlogs it's producing. So cannot really debug. As mentioned the only way I found to reproduce getting a similar errormesage, but also not fully sure this is the exact same issue, or how it's caused.
Hi,
Nil values on iCloud CloudKit causing errors.
In my CoreData model there is Consult entity that has mandatory fields for date, moddate (record modification date )and creadate (record creation date). Moddate and creadate are actually determined (together with the uniqueIdentifier) in the awakeFromInsert(), moddate is updated by the willSave() method. A user doesn’t have any way to influence values for creaDate and modDate. Also the date field is mandatory, but app will give an error if the user tries to save without having entered a valid Date. As these 3 fields are mandatory (non optional attributes), CoreData won’t save the record without being present.
Now I have a seemingly rare condition that SyncKit sync is failing because of several but not all Consult records missing these values. So it seems SyncKit is downloading fine, but the CD doesn’t allow saving them. The error I get is (not a ckerror, but an error provided by CD):
This repeated for about 20 but not all Consult records. These 3 fields and the uniqueIdentifier are the only non-optional fields. But the error only mentions the 3 dates, but not nil for the uniqueIdentifier. So as there is no 1570 error for nil on unqueId I’m assuming it’s not nil, or SyncKit would assign something to it before saving.
I can reproduce the same error by going into Apple’s cloudkit webinterface and manually deleting one of these values (of course I can only do this with the dev account). Then starting a SyncKit sync.
Any idea how it’s possible that -somehow- in iCloud multiple records would have become nil values (for at least these fields, maybe more)? Normally this shouldn’t be possible, but somehow it did. What can be done to avoid this? Could this be caused by a bug in SyncKit?
Of course there is no way for a user to correct this, besides deleting all data in CloudKit and to sync again.
SyncKit v 0.8.0 on iOS 14.3.
In Consult+CoreDataProperties.swift:
Thanks,
Rodge
The text was updated successfully, but these errors were encountered: