Hi Apple Developers, I'm having a problem with evaluatedPolicyDomainState: on the same device, its value keeps changing and then switching back to the original. My current iOS version is 26.1. I upgraded my iOS from version 18.6.2 to 26.1. What could be the potential reasons for this issue?
{
NSError *error;
BOOL success = YES;
char *eds = nil;
int edslen = 0;
LAContext *context = [[LAContext alloc] init];
// test if we can evaluate the policy, this test will tell us if Touch ID is available and enrolled
// success = [context canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
if (SystemVersion > 9.3) {
// test if we can evaluate the policy, this test will tell us if Touch ID is available and enrolled
success = [context canEvaluatePolicy: LAPolicyDeviceOwnerAuthentication error:&error];
}
else{
// test if we can evaluate the policy, this test will tell us if Touch ID is available and enrolled
success = [context canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
}
if (success)
{
if (@available(iOS 18.0, *)) {
NSData *stateHash = nil;
if ([context respondsToSelector:@selector(domainState)]) {
stateHash = [[context performSelector:@selector(domainState)] performSelector:@selector(stateHash)];
}else{
stateHash = [context evaluatedPolicyDomainState];
}
eds = (char *)stateHash.bytes;
edslen = (int)stateHash.length;
} else {
eds = (char *)[[context evaluatedPolicyDomainState] bytes];
edslen = (int)[[context evaluatedPolicyDomainState] length];
}
CC_SHA256(eds, edslen, uviOut);
*poutlen = CC_SHA256_DIGEST_LENGTH;
}
else
{
*poutlen = 32;
gm_memset(uviOut, 0x01, 32);
}
}