Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

XCTestCase: set NewValue return False #176

Open
javierbc121086 opened this issue Jan 20, 2022 · 2 comments
Open

XCTestCase: set NewValue return False #176

javierbc121086 opened this issue Jan 20, 2022 · 2 comments

Comments

@javierbc121086
Copy link

Hi, I try save string data on keychain, however, the function set return False.

Any idea ?

I post the code:

    public static var tokenSession: String {
        set {
            KeychainWrapper.standard.set(
                newValue,
                forKey: "sm_token_session_key",
                withAccessibility: .always,
                isSynchronizable: true
            )
        }
        get {
            KeychainWrapper.standard.string(
                forKey: "sm_token_session_key",
                withAccessibility: .always,
                isSynchronizable: true
            ) ?? .empty
        }
    }
@mrmurphy
Copy link

@javierbc121086 it might work if you remove isSynchronizable. I'm guessing there's some info plist permission that needs to be added for sync to work. Maybe https://developer.apple.com/documentation/security/keychain_services/keychain_items/sharing_access_to_keychain_items_among_a_collection_of_apps?

@mrmurphy
Copy link

Ah note, there must be something else going on here. The reason I wasn't getting anything back in my code was that I wasn't passing isSynchronizable to both the getter and the setter, just the setter. They both need it.

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

No branches or pull requests

2 participants