Question

Is there any other alternative to get WOEID of a place, other than yahoo services? Is there any third party library which is free?

Was it helpful?

Solution

You can get it by making a query request using the city name you want and hitting yahoo service with code like this:

NSString *request = [NSString stringWithFormat:@"http://query.yahooapis.com/v1/public/yql?q=select * from geo.places where text=\"%@\"&format=xml", cityName];
NSString *encRequest = [request stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *URL = [NSURL URLWithString:encRequest];

I've put the complete example for this in github, but this is a solution just for testing purposes. You should use the official way (and pay if needed) for a commercial app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top