nil value from dictionary when the application runs on MacOS 11.3 or higher

I have this method, which is used to get a value from a dictionary, specifying a desired label. The desired label and the dictionary are passed as parameters:

- (NSString *)x509ValueForLabel:(NSString *)desiredLabel fromDictionary:(NSDictionary *)dict {
    @try {
        NSArray *valArray = dict[(__bridge NSString *)kSecPropertyKeyValue];
        
        for (NSDictionary *curCertVal in valArray) {
            NSString *valueLabel = curCertVal[(__bridge NSString *)kSecPropertyKeyLabel];
            
            if ([valueLabel isEqual:desiredLabel]) {
                return curCertVal[(__bridge NSString *)kSecPropertyKeyValue];
            }
        }
        return nil;
    }
    @catch (NSException *e) {
        return nil;
    }
}

This code works properly on MacOS versions prior to 11.3.

If the application is installed on MacOS 11.3 or higher, this code doesn't work (in the same context that it is working for prior versions). I mean, the dictionary where the value is searched is made from a file; using the same file, searching for the same desired label works fine for versions prior to 11.3 but not for 11.3 or higher.

In addition, if the application is installed and works properly and then MacOS is upgraded to 11.3 or higher, the application continues working fine.

After debugging, I have found that the method returns nil because it doesn't found the desired label (the conditional inside the for loop is always false).

The questions are: there are some changes at system level (for example, the values of globals) that can lead to this behaviour? or there is something that is not properly managed into the method for newer MacOS?

Any help would be appreciated. Thanks in advance.

Could you NSLog to see exactly what you have for valueLabel and desiredLabel?

nil value from dictionary when the application runs on MacOS 11.3 or higher
 
 
Q