gpt4 book ai didi

objective-c - 当 NSDictionary 不知道它的 future 内容时,它如何支持 NSSecureCoding

转载 作者:行者123 更新时间:2023-12-03 16:40:22 27 4
gpt4 key购买 nike

根据Apple规范,当一个类支持NSSecureCoding时,它应该使用

decodeObjectOfClass:forKey:

在 initWithCoder

但是由于字典不知道其内容,它如何支持安全编码?

与自定义对象相反,自定义对象的属性类是已知的

最佳答案

According to this answer基础容器(数组、字典、集合,其他……?)并不像人们想象的那么安全。显然,只有已知的基础类才被认为是安全的,这意味着使用 NSSecureCoding 时默认实现不允许存储自定义对象。

最重要的引言:

[...] if you use NSArray() or other collection classes directly in your coding, you need to check what you got back. They are ‘securely’ decoded to the extent that Apple believes decoding them will not result in a buffer overflow etc, that’s all you get by default. [...]

关于objective-c - 当 NSDictionary 不知道它的 future 内容时,它如何支持 NSSecureCoding,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41100542/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com