According to the documentation of the NSKeyedArchiver
class,
A keyed archive differs from a non-keyed archive in that all the objects and values encoded into the archive are given names, or keys.
In order to archive elements of a struct
and give keys to them NSKeyedArchiver
would need metadata to know where each field of a struct
is located, and what are the names of these fields. The @encode
stored with NSValue
gives it enough information about the layout of a struct
, but the information about the names of each field is missing.
Since there is no metadata about the names of the fields in a struct
, it would be impossible to archive the data in such a way as to ensure proper un-archiving. That is why NSKeyedArchiver
must refuse to archive NSValue
s with embedded C struct
s.