Re: Verbose warning splurged to the log with Secure Coding (dearchiving) -- can they be serious?


Ben Kennedy
 

On 24 Feb 2022, at 2:07 am, Graham Cox <graham@...> wrote:

The actual class is __NSCFConstantString, rather than just a generic NSString, that seems to be what it is complaining about — if I change it to use [NSString class] it’s fine.

Since the archive originally wrote the result of NSStringFromClass(), it will of course write the explicit class rather than the more general umbrella class of a cluster. Can you think of a simple solution for this, in general?
In respect of this particular issue, I think if you call `classForCoder` rather than `class` on the object of interest, you'll get the portable class name ("NSString") you're looking for.

-ben

Join cocoa@apple-dev.groups.io to automatically receive all group messages.