Core Data transformable attribute problem in Xcode16

Hi everyone,

Have anybody faced with Core Data issues, trying to migrate the project to Xcode16 beta 4? We are using transformableAttributeType in some entities, with attributeValueClassName = "[String]" and valueTransformerName = "NSSecureUnarchiveFromData". It is working just fine for years, but now I am trying to run the project from Xcode16 and have 2 issues:

  1. in Xcode logs I see warning and error:

CoreData: fault: Declared Objective-C type "[String]" for attribute named alertBarChannels is not valid

CoreData: Declared Objective-C type "[String]" for attribute named alertBarChannels is not valid

  1. periodically the app crashes when we are assigning value to this attribute, with error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString characterAtIndex:]: Range or index out of bounds'

Once again, in Xcode 15 it works fine, and it was working for years. Cannot find any information about what was changed in the framework... Thank you in advance for any information, which could clarify what is going on.

Were you able to find any solution for this issue? I'm also facing the same issue.

Any update?

I am facing the same issue with transformable attributes with Xcode 16 beta 6

fault: Declared Objective-C type "[Int]" for attribute named .... is not valid
CoreData: fault: Declared Objective-C type "[Int]" for attribute named .... is not valid
CoreData: Declared Objective-C type "[Int]" for attribute named .... is not valid

Finally in Xcode 16 beta 6 I have no warnings and no crashes.

@AGDq interesting, but our 'Declared Objective-C type "[String]" ...' disappear in beta 6...

hi,

downloaded the release version of Xcode 16.0 (16A242d) last night ... and today i ran into this warning.

I will just summarise solution, which works to us (thanks a lot @AGDq ) :

  • combination attributeValueClassName: [String], valueTransformerName: NSSecureUnarchiveFromData does not work now, works combination attributeValueClassName: NSArray, valueTransformerName: NSSecureUnarchiveFromData.

The @NSManaged variable could still be array of strings, like: @NSManaged public internal(set) var routes: [String]?

  • if you use own valueTransformer, like attributeValueClassName: MyLocation. valueTransformerName: LocationValueTransformer, both classes should be marked as @objc(name of class). Without the names there will be warnings in the Xcode log

  • if use set valueTransformerName = "NSSecureUnarchiveFromData", you need to set some class name to attributeValueClassName property, either NSObject, NSArray or own, otherwise the app will periodically crashes. Before it could be empty and it worked as NSObject

Appreciate the answer above does appear to fix the issue, but this isn't really an ideal solution, and doesn't help us understand how we should be using transformers really.

Specifically I feel like there's code smell around type erasure as a solution here, given that we're dealing with Foundation objects.

I ran into the "Declared Objective-C type "[String]" for attribute named..." issue too. The thing that seemed to help was changing the Custom Class from "[String]" to "NSArray<String>". Hope that helps!

Core Data transformable attribute problem in Xcode16
 
 
Q