Strange Core Data Error Message

Good morning.

We are using Contentful to manage data in our application, and we have been very satisfied with the ease of use and seamless APIs so far.

Since using it however we have been getting a strange error when using the ContentfulPersistence SDK to manage our data model - one that appears in the debug console when running sync:

[error] fault: One or more models in this application are using transformable properties with transformer names that are either unset, or set to NSKeyedUnarchiveFromDataTransformerName. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead. At some point, Core Data will default to using "NSSecureUnarchiveFromData" when nil is specified, and transformable properties containing classes that do not support NSSecureCoding will become unreadable.

My research indicated that this simply meant: whichever transformable properties exist in our .xcdatamodel should have their transformer explicitly set as NSSecureUnarchiveFromData.

We have a single Transformable property in our .xcdatamodel which maps from a Contentful.Location object. We set this property’s transformer as suggested.

When running the app (from a clean build) now, we get a crash with an NSInvalidUnarchiveOperationException -

The data couldn’t be read because it isn’t in the correct format. with userInfo of { NSUnderlyingError = "Error Domain=NSCocoaErrorDomain Code=4864 \"value for key 'root' was of unexpected class 'Contentful.Location'. Allowed classes are '{(\n NSDate,\n NSURL,\n NSSet,\n NSString,\n NSUUID,\n NSData,\n NSArray,\n NSNumber,\n NSNull... (etc)

Further research suggested that Contentful.Location might need to conform to NSSecureCoding, so I added this conformance in an extension. Unfortunately this did nothing to fix the above crash.

Failing this, I removed the extension and reverted the transformable property, setting it back to default (blank).

When running now, the app works as normal with no error message. However. there is one change - the .xcdatamodel file has some big changes:

Every single property in the data model has gone from having a syncable=YES attribute to having this attribute removed; e.g.

Before:
<entity name="Asset" representedClassName="Asset" syncable="YES"> <attribute name="assetDescription" optional="YES" attributeType="String" syncable="YES"/>

After:
<entity name="Asset" representedClassName="Asset" syncable="YES"> <attribute name="assetDescription" optional="YES" attributeType="String"/>
(The top-level object descriptions retain their syncable attribute).

Looking on my own, it looks like the syncable attribute was a deprecated MacOS persistence option, with the latest documentation from 2011. So it seems likely that it is an attribute that the SDK applies.

Are you able to help shed some light on how we might be able to resolve this error?