Search code examples
swiftiphoneswiftuiface-id

Registration of a new FaceID user on iphone from within an app, using Swift code


iPhone has a FaceID user registration or enrollment process through an option found in the settings section. Is it possible to trigger this process from within an app, using Swift code?


Solution

  • It is not simple possible to launch a FaceID registration process from an app, because this would be unsafe. But you can open the settings app and even the settings of your app via an URL. There you can see if the app is able to use FaceID. This is the closest you can get to the FaceID & Code Settings. Probably give the user some instruction where to find it.

                    guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
                        return
                    }
                    if UIApplication.shared.canOpenURL(settingsUrl) {
                                UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
                                    print("Settings opened: \(success)") // Prints true
                                })
                            }