Re: NSMeasurementFormatter reversed


Quincey Morris
 

On Sep 26, 2018, at 09:44 , Gerriet M. Denkmann <g@...> wrote:

NSString *temp1 = [NSUserDefaults.standardUserDefaults stringForKey: @"AppleTemperatureUnit"];

NSString *temp2 = [ NSLocale.currentLocale objectForKey: @"kCFLocaleTemperatureUnitKey"];

FOUNDATION_EXPORT NSLocaleKey const NSLocaleTemperatureUnit;
NSString *temp3 = [ NSLocale.currentLocale objectForKey: NSLocaleTemperatureUnit];

Be careful with this. If you look at some of the Stack Overflow posts about this, it seems to be regarded as private API, and a cause for rejection by App Review.

I think the real answer is that getting the region setting for temperature is just not supported. There may not be a good, future-proof mechanism for getting the setting you want.

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.