Skip to content

Possible issue with keychain and archiving objects #20

@jsm174

Description

@jsm174

I believe I am having an issue when trying to get archived objects from the keychain.

They always come back as nil.

Take the following code:

        var preferences = UserDefaults.standard
        preferences["color", .archive] = UIColor.red
        let color = preferences["color", .archive]  as? UIColor
        print(color)
        
        var keychainPreferences = KeychainPreferences.sharedInstance
        keychainPreferences["color2", .archive] = UIColor.red
        let color2 = keychainPreferences["color2", .archive]  as? UIColor
        print(color2)

Results in:

Optional(UIExtendedSRGBColorSpace 1 0 0 1)
nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions