For those who have the same problem
It just happens with iOS 13 and above. The solution tries to call the function evaluatetwice like this:
let systemVersion = UIDevice.current.systemVersion
if systemVersion.compare("13.0", options: .numeric) != .orderedAscending {
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Authenticate to open the app", reply: { (_, _) in
})
}
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: "Authenticate to open the app", reply: { (success, error) in
})
Tested and works well for all versions of iOS 13.xx
source
share