sindresorhus / Defaults

💾 Swifty and modern UserDefaults
https://swiftpackageindex.com/sindresorhus/Defaults/documentation/defaults
MIT License
1.99k stars 119 forks source link

-[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1e1552fd8) [/System/Library/Frameworks/Foundation.framework]' #178

Open bukira opened 3 months ago

bukira commented 3 months ago

I am getting the following error

-[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0x1e1552fd8) [/System/Library/Frameworks/Foundation.framework]' for key '****', even though it was not explicitly included in the client allowed classes set: '{( )}'. This will be disallowed in the future.

I think this is an error in Defaults as I am using defaults to save a custom object and the object conforms to __DefaultsSerializable_

if found this

Specifying the type here fixed it: override static var allowedTopLevelClasses: [AnyClass] { return [NSArray.self, NSString.self] }

sindresorhus commented 3 months ago

Is it a logged warning or an error?

It would be great if you could submit a failing test.

bukira commented 3 months ago

it is a logged warning, it works fine now but I get the error repeatedly every time I access Defaults[.myValue]