使用自定义 DataTransformers 时,Xcode 13 和 iOS 15 开始发出关于 MissingAllowedClasses 的警告。关于自定义 DataTransformers 的文档非常少,所以我想我应该在这里发布一个问题并回答它。
[general] *** -[NSKeyedUnarchiver _warnAboutPlistType:missingInAllowedClasses:] allowed unarchiving safe plist type ''NSString' (0x1dc9a7660) [/System/Library/Frameworks/Foundation.framework]', even though it was not explicitly included in the client allowed classes set: '{(
"'NSArray' (0x1dc99c838) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
Run Code Online (Sandbox Code Playgroud)
请注意,在警告消息中,它指定了“NSArray”,并且缺少类型“NSString”。