MapKit in iOS 6 - How to find places nearby ...?

Using MapKit in iOS 6, how should I get neighboring locations without their specific coordinates? I'm also not sure that it is still possible ... err ... is allowed ... to use the Google Maps API to achieve this, as this is the only way I can do this.

I know that everything is still in beta, but I still have not found any information about this topic in the forums, in Apple’s new MapKit documentation anywhere. All I want to do is search for locations (such as parks, for example) within "x" miles from the user's location.

It seems that since Apple developed their own Maps application, they should have a way to accomplish this using MapKit or Core Location ... right?

+5
source share
1 answer

Try using this code. It can help you.

URLManager *urlmanager = [[URLManager alloc] init];
        urlmanager.delegate = self;
        urlmanager.responseType = JSON_TYPE;
        urlmanager.commandName = @"Search";

NSString *locationString = [NSString stringWithFormat:@"%f,%f",latitude,longitude];
//Location where you want to search

NSString *key = @"AIzaSyCNRpero6aM451X0IfgFHAd-Y3eJUssqoa8`enter code here`0E";
//This is the secret key which you will get from the Google API Console when you register your app.

NSString *radiuos = @"15000";
//This is the area within which you want to search
NSString *keyword = @"Hotel";//Search keyword you want to search

NSMutableDictionary *arguments = [[NSMutableDictionary alloc] init]; // zero argument

[arguments setValue:key forKey:@"key"];

[arguments setValue:locationString forKey:@"location"];

[arguments setValue:radiuos forKey:@"radius"];

[arguments setValue:@"true" forKey:@"sensor"];

[arguments setValue:keyword forKey:@"keyword"];

NSLog(@"Arguments are %@",arguments);

[urlmanager urlCallGetMethod:[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json"] withParameters:arguments];
+2
source

All Articles