提问人:EK412 提问时间:10/13/2021 最后编辑:karelEK412 更新时间:9/10/2022 访问量:1166
自 iOS 15 以来的 NSKeyedUnarchiver 警告
NSKeyedUnarchiver Warnings since iOS 15
问:
自 iOS 15 以来,我不断收到类似的警告。我使用的唯一框架是 Mapbox。是否有解决方法或修复方法?
2021-10-13 10:03:39.530114+0200 DemoApp[2661:532530] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSNumber' (0x1dcadbe40) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'NSDictionary' (0x1dcad0c28) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
2021-10-13 10:03:39.530315+0200 DemoApp[2661:532530] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1dcadb6e8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'NSDictionary' (0x1dcad0c28) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
2021-10-13 10:03:39.530365+0200 DemoApp[2661:532530] [general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1dcadb6e8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'NSDictionary' (0x1dcad0c28) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
答:
0赞
Yohst
9/10/2022
#1
在代码(或库)中的某个位置,必须调用 NSKeyedUnarchiver,如下所示:
如果让 yourObject = try?NSKeyedUnarchiver.unarchivedObject(ofClass: yourclass.self, 来自:dataVariable) { }
“yourClass”包含一个必须显式允许的 String 对象,因此请将代码更改为:
如果让 yourObject = try?NSKeyedUnarchiver.unarchivedObject(ofClasses: [YourClass.self, NSString.self], from: dataVariable) 作为?您的班级 { }
评论
plist