Reputation: 797
I'm trying to create a small weather app.
What is the best practice to figure out what degree setting the user have? (Celcius or Fahrenheit) Is it possible to read that from the built in weather app?
Upvotes: 4
Views: 6027
Reputation: 726479
To answer the original question about the display settings, I'd try this:
NSLocale *locale = [NSLocale currentLocale];
BOOL usesMetric = [[locale objectForKey:NSLocaleUsesMetricSystem] boolValue];
If usesMetric
is YES
, I would use Celsius; otherwise, I'd use Fahrenheit.
Upvotes: 15
Reputation: 55533
You would need to find a web API for this, here are a few:
Upvotes: 7
Reputation: 4155
There is no way to read the weather from anywhere on the phone, including other apps...the iPhone Weather app uses the Yahoo weather API. You can use that or the Google one: http://blog.programmableweb.com/2010/02/08/googles-secret-weather-api/
There is no way to get around it without a server call :)
(I am assuming you are interested in the weather and not just the temperature).
Upvotes: 1