aws-amplify / amplify-ui-swift-liveness

This repository offers a UI component for Amazon Rekognition Face Liveness, enabling developers to ensure that only authentic users, and not bad actors using spoofs, can access their services.
https://ui.docs.amplify.aws/swift/connected-components/liveness
Apache License 2.0
10 stars 25 forks source link

[iOS]Camera permission error occurs when entering the background #166

Closed hyunseokYang closed 3 months ago

hyunseokYang commented 3 months ago

Describe the bug

Hello. I'm inquiring about an error while testing this package in iOS.

in FaceLivenessDetectorView, After reaching the DisplayState.displayingLivense state When the app is inactive (or background) FaceLivenessDetectionError(code: 5, message: "Camera permissions have not been granted.", recoverySuggestion: "Prompt the user to grant camera permission.") An error occurs.


My example code
...
...

FaceLivenessDetectorView(
                sessionID: sessionId,
                region: region,
                isPresented: Binding(
                    get: { true },
                    set: { _ in }
                ),
                onCompletion: { result in
                    switch result {
                    case .success:
                        // success process
                    case .failure(let error):
                        /// Here !! error occurs
                    default:
                        // default process                 
                    }
                }
            )

Of course, the camera permission was already authorized.

Steps To Reproduce

Steps to reproduce the behavior:
1. FaceLivenessDetectorView show
2. Click on beginCheckButton
3. go to background
4. occurs error

Expected behavior

No error occurs

Swift Liveness Version

1.2.16

Xcode version

Version 15.2 (15C500b)

OS Version

iOS 15.7.1

Device

iPhone 12

ruisebas commented 3 months ago

Hi @hyunseokYang, thanks for opening this issue. The team will take a look and post updates here.

ruisebas commented 3 months ago

This has been fixed in version 1.3.1: moving the app to the background during a liveness check now results in a .userCancelled error. Please update your dependency.

Thanks!

github-actions[bot] commented 3 months ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.