I get several warnings in log:
*** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving
safe plist type ''NSNumber' (0x204cdbeb8)
[/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects',
even though it was not explicitly included in the client allowed classes set: '{(
"'NSArray' (0x204cd5598) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
I am not sure how to understand it:
- I have removed every NSNumber.self in the allowed lists for decode. To no avail, still get the avalanche of warnings.
- What is the key NS.objects about ?
- What may allowed classes set: '{( "'NSArray' be referring to ? An inclusion of NSArray.self in a list for decode ? The type of a property in a class ?
SOLVED.
I did log a message before each call of decoder.decodeObject(of: key:)
That let me find the issue, and replace:
self.aVar = decoder.decodeObject(of: NSArray.self, forKey: someKey) as? someClass
by
self.aVar = decoder.decodeObject(of: [NSArray.self, NSSet.self, NSNumber.self], forKey: someKey) as? someClass
Effectively, someClass has properties that have NSSet properties as well as Int.
That was my error, but I still think that Xcode should be able to guess this and provide clearer messages or propose autocompletion. Not yet the case in Xcode 16.4 nor 26.2. I'll file a bug report for enhancement.