NSDateFormatter time does not change according to phone settings

this one is killing me, I have the following date format:

+ (NSDateFormatter *)dateFormatter {
    static NSDateFormatter *_dateFormatter = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSString *format = [NSDateFormatter dateFormatFromTemplate:@"hh:mm a" options:0 locale:[NSLocale currentLocale]];
        _dateFormatter = [[NSDateFormatter alloc] init];
        [_dateFormatter setDateFormat:format];
    });
    return _dateFormatter;
}   

I want the final hour format to match the settings of the user clock, so if the user uses "24-hour time", the result should be, for example:

19:41

Otherwise, the result should be

7:41 PM

ok now for the kill me part, this seems to work fine if I set the Region Format phone to United States.
If I turn the 24-hour time on / off, the date does change from 19:41to7:41 PM

, " " - , " ", "", 7:41 PM , / "24- ".

, :

@"HH:mm a" (changed hh to uppercase HH)

"" "24- ", "United State" 24- , , !

?!

, , dateFormatFromTemplate .

+1
1

NSDate *time;
if ([objShare checkTimeFormat]){
    [timeFormat setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];;
    [timeFormat setDateFormat:@"hh:mm a"];
    NSLog(@"%@",lblVtime.text);
    time = [timeFormat dateFromString:lblVtime.text];
}
else{
     NSLog(@"%@",lblVtime.text);
    [timeFormat setDateFormat:@"hh:mm a"];
    time = [timeFormat dateFromString:lblVtime.text];
}
[timeFormat setDateFormat:@"HH:mm"];
NSLog(@"%@",[timeFormat stringFromDate:time]);

,

checkTimeFormat:

-(BOOL)checkTimeFormat{
     NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
     [formatter setLocale:[NSLocale currentLocale]];
     [formatter setDateStyle:NSDateFormatterNoStyle];
     [formatter setTimeStyle:NSDateFormatterShortStyle];
     NSString *dateString = [formatter stringFromDate:[NSDate date]];
     NSRange amRange = [dateString rangeOfString:[formatter AMSymbol]];
     NSRange pmRange = [dateString rangeOfString:[formatter PMSymbol]];
     BOOL is24h = (amRange.location == NSNotFound && pmRange.location == NSNotFound);
     return is24h;
}
0