SwiftKeychainWrapper
SwiftKeychainWrapper copied to clipboard
Incrementing and saving do not work properly
I am testing my app on my phone via Xcode 13.3.1.
I removeAllKeys upon launch, then set a new integer value for a consumable product.
KeychainWrapper.standard.integer(forKey: productIdentifier) ?? 0
- This value is zero (0) when I first read it.
- I read it, increment it by one and save it. Then read it again. It reads 2 instead of 1.
- If I repeat step 2, I still get 2.
Rebooting the phone changed nothing.
Does anybody experience something similar?
There is no problem when I set the value like so:
KeychainWrapper.standard.set(value, forKey: key, isSynchronizable: true)
And remove the key-value like so:
KeychainWrapper.standard.removeObject(forKey: key, isSynchronizable: true)