NSKeyedUnarchiver Warnings since iOS 15

1.3k Views Asked by At

Since iOS 15 I keep getting warnings like those beyond. Only framework I'm using is Mapbox. Is there a workaround or fix?

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.
1

There are 1 best solutions below

0
Yohst On

Somewhere in your code (or library) you must have a call to NSKeyedUnarchiver that looks like:

if let yourObject = try? NSKeyedUnarchiver.unarchivedObject(ofClass: yourclass.self, from: dataVariable) { }

Your 'yourClass' contains a String object that must be explicitly allowed, so change your code to:

if let yourObject = try? NSKeyedUnarchiver.unarchivedObject(ofClasses: [YourClass.self, NSString.self], from: dataVariable) as? YourClass { }