sindresorhus / sindresorhus/Defaults

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

Open
#178 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
2.5k
Forks
163
PR merge metrics
No merged PRs in 30d

Description

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]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start at the Defaults serialization path for custom objects conforming to __DefaultsSerializable and inspect the allowedTopLevelClasses behavior; done means reproducing the warning and confirming that decoding the custom object no longer reports NSString as missing from the allowed classes.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
desktop-dev, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.