mentrena / SyncKit

Automatic CloudKit synchronization
https://mentrena.github.io/SyncKit/
MIT License
507 stars 59 forks source link

CoreData URL/URI type fields not synced #178

Open nneubauer opened 2 years ago

nneubauer commented 2 years ago

Hi again,

I encountered problem: My Core Data model contains a bunch of field of type (optional) URI which translate to NSManaged public var foo: URL?. Looking into the CloudKit dashboard after the initial sync all those fields are missing in the corresponding record type. Any idea why this is? Do I need to go with a Transformable instead for URLs?

Thanks!

nneubauer commented 2 years ago

For reference, switching to Transformable with the custom type URL does work for me but the original question remains.

mentrena commented 2 years ago

Record properties must be of a type that conforms to CKRecordValueProtocol, which includes: Array(Conforms when Element conforms to CKRecordValueProtocol.) Bool CKAsset CKRecord.Reference CLLocation Data Date Double Float Int Int16 Int32 Int64 Int8 NSArray NSData NSDate NSNumber NSString String UInt UInt16 UInt32 UInt64 UInt8

Using Transformable is probably the best approach. Another option would be just storing them as Strings, or using CoreDataAdapterRecordProcessing to convert URL<->String at the point CKRecords are created.

aehlke commented 1 year ago

I added URL andothers in my BigSyncKit fork https://github.com/lake-of-fire/BigSyncKit which is still a bit WIP but I'm shipping to prod w/ it on ios and macos