kishikawakatsumi / KeychainAccess

Simple Swift wrapper for Keychain that works on iOS, watchOS, tvOS and macOS.
MIT License
7.95k stars 789 forks source link

"User interaction is not allowed" issue #488

Closed alrose closed 4 years ago

alrose commented 4 years ago

I'm facing an issue with at least one user that can't access to keychain data.

KeychainAccess version: 4.2.0 Xcode version 11.5 (11E608c) iOS version 13.5.1

first time I realized about the issue the accessibility had the default value but to be sure that that was not the problem I've set it as "always" and the issue was not solved.

 fileprivate let keychain = Keychain().accessibility(.always)

func getAuthToken() -> String? {
    do {
        let token = try keychain.getString(authTokenKey)
        if token == nil {
            gblLogging.error("getAuthToken token is nil")
        } else if token!.isEmpty {
            gblLogging.error("getAuthToken token is empty]")
        }
        return token
    } catch let error {
        gblLogging.error("getAuthToken error : \(error.localizedDescription)")
    }
    return nil
}

what I see from the logs is that when the app run there is no issue, but soon after the app goes to background the user start facing the issue

getAuthToken error : User interaction is not allowed.

I was not able to reproduce the issue myself, also for other testers it's working fine (they are more than 20) but for that user the problem is consistent

any idea what can be the problem?

thanks!

sree127 commented 4 years ago

Hey @alrose , we just stumbled upon the same issue. Did you find what the reason was?