SwiftKeychainWrapper icon indicating copy to clipboard operation
SwiftKeychainWrapper copied to clipboard

Incrementing and saving do not work properly

Open harmancode opened this issue 3 years ago • 1 comments

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

  1. This value is zero (0) when I first read it.
  2. I read it, increment it by one and save it. Then read it again. It reads 2 instead of 1.
  3. If I repeat step 2, I still get 2.

Rebooting the phone changed nothing.

Does anybody experience something similar?

harmancode avatar May 24 '22 00:05 harmancode

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)

harmancode avatar May 24 '22 21:05 harmancode