Daily iOS
Persistence

Archiving and plists

Legacy code saves model objects to a file with NSKeyedArchiver, and on recent OS versions unarchiving started warning and crashing. What's the difference between NSCoding and NSSecureCoding?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

NSSecureCoding makes you name the allowed classes when you decode, which blocks arbitrary object injection. The unarchiving APIs are secure by default now, so they fail when you don't give the class list.

Share a question