You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My problem is when I use Xcode 11.5 simulator iOS 10.3.1 test Defaults.shared.has(.userIdKey) function (.userIdKey is String type) after I use clear the value, it's always return true. But when I use Defaults.shared.get(for: .userIdKey) is nil.
So I debug has function source code "po userDefaults.value(forKey: key._key)" is ▿ Optional
First thanks for sharing this useful frame.
My problem is when I use Xcode 11.5 simulator iOS 10.3.1 test Defaults.shared.has(.userIdKey) function (.userIdKey is String type) after I use clear the value, it's always return true. But when I use Defaults.shared.get(for: .userIdKey) is nil.
So I debug has function source code "po userDefaults.value(forKey: key._key)" is ▿ Optional
(lldb) po userDefaults.object(forKey: key._key)
▿ Optional
I test same code on iOS 11.4, iOS12, iOS13 on simulator are all correct.
I don't know what's make this issue. I have no real machine with version 10.3.1 to test it.
At last I use userDefaults.string(forKey: key._key) test it is correct, It seems userDefaults.value have problem on iOS 10.3.1 version.
May be public func has(_ key: Key) we can get value type first, then use match function get value is better.
The text was updated successfully, but these errors were encountered: