Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSKeyedArichiver error #10

Open
3 tasks done
thegalkin opened this issue Jun 11, 2022 · 0 comments
Open
3 tasks done

NSKeyedArichiver error #10

thegalkin opened this issue Jun 11, 2022 · 0 comments

Comments

@thegalkin
Copy link

Description

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__SwiftValue encodeWithCoder:]: unrecognized selector sent to instance 0x600002592800'
terminating with uncaught exception of type NSException

Requirements (place an x in each of the [ ])

  • I've read and agree to the Code of Conduct.
  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

The reason of the crash is the following function:
private func setSecret (_ value: Any?, forKey defaultName: String) { if let value = value { let data = NSKeyedArchiver.archivedData (withRootObject: value) super.set (try? encrypter?.encrypt (data), forKey: defaultName) return } super.set (nil, forKey: defaultName) }

Only NSCoding conforming objects can be stored in NSKeyedArchive as far as I know.

Reproducible in:

SecureDefaults version: 1.0.7

iOS version: 15.5

Steps to reproduce:

  1. set value with type that is not available for obj-c
  2. get crash

Expected result:

It should save the value

Actual result:

crash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant