Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图保存NSTimeZone为可转换类型,但它似乎不起作用,因为它符合NSSecureCoding.
NSTimeZone
NSSecureCoding
有没有其他选择?
如果 TimeZone 有一个 defined name,您可以将它存储为一个字符串。如果您根据 GMT 偏移量手动构建时区,它可能没有名称。
name
...因此,如果需要,您可以存储 GMT 偏移量,但是您将丢失与指定时区关联的任何 DST 信息。
可能最好的方法是存储data. 这应该包含重建适当NSTimeZone实例所需的信息。
data