evgenyneu/keychain-swift

Sometimes the value obtained changes

Serakaterina opened this issue · 0 comments

private static let keychain = KeychainSwift()

private static let KWNETWORKUUIDKEY = "kw_network_uuid_key"

static func idfv() -> String {
    semaphore.wait()
    var result = keychain.get(KWNETWORKUUIDKEY)
    var log = ""
    if result == nil {
        let temp = UIDevice.current.identifierForVendor?.uuidString
        result = temp
        if result != nil {
            let saveRes = keychain.set(result!, forKey: KWNETWORKUUIDKEY)
        }
    }
    if result == nil || result!.isEmpty {
        exit(0)
    }
    semaphore.signal()
    return result!
}

The value obtained through the “get value for key” method will change. Can anyone give me an answer?