[general] *** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x112bdaf38) [/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework]' for key 'NS.keys', even though it was not explicitly included in the client allowed classes set: '{(
"'NSDictionary' (0x114e42a70) [/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
To fix this, MMEEvent._attributesStorage must declare explicitly every supported classes while unarchiving.
This line:_attributesStorage = [aDecoder decodeObjectOfClass:NSDictionary.class forKey:MMEEventAttributesKey];
Should be replaced by this line:_attributesStorage = [aDecoder decodeObjectOfClasses:@[NSDictionary.class, NSString.self, NSNumber.self] forKey:MMEEventAttributesKey];
Starting from iOS 15,
NSKeyedUnarchiver
stated to throw warnings when unarchiving data types not included in the class set.The following line is printing a bunch of warnings in the console: https://github.com/mapbox/mapbox-events-ios/blob/d505e0875e3492c7fccc532bd8f99ddd1e901937/Sources/MapboxMobileEvents/MMEMetricsManager.m#L318
The warnings looks like this:
To fix this,
MMEEvent._attributesStorage
must declare explicitly every supported classes while unarchiving.This line:
_attributesStorage = [aDecoder decodeObjectOfClass:NSDictionary.class forKey:MMEEventAttributesKey];
Should be replaced by this line:
_attributesStorage = [aDecoder decodeObjectOfClasses:@[NSDictionary.class, NSString.self, NSNumber.self] forKey:MMEEventAttributesKey];