附近地点查找Google MAP SDK

时间:2013-09-12 09:53:14

标签: iphone ios google-maps-api-3 google-maps-sdk-ios

我在我的applcation中使用了GOOGLE MAP SDK for ios而不是apple map。我已经通过谷歌API调用寻找附近的resturants.But没有提到如何在Google MAP SDK for ios中使用谷歌api,在这里我的代码,

-(void)loadView {
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:11.0183
                                                        longitude:76.9725
                                                             zoom:15];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
mapView_.delegate = self;
self.view = mapView_;

mapView_.mapType = kGMSTypeSatellite;
}

我应该在哪里使用谷歌API来查找附近的使用

的重新调整剂
NSString *url = [NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/search/json?location=%@,%@&radius=%@&types=%@&sensor=false&key=%@",StrCurrentLatitude ,StrCurrentLongitude,@"2000",@"restaurant",kGOOGLE_API_KEY];

请帮我解决一下!

1 个答案:

答案 0 :(得分:-1)

在CLLocationManagerDelegate中,函数:

- (void)locationManager:(CLLocationManager *)manager      didUpdateLocations :( NSArray *)位置

一旦你得到当前位置 currentLocation = [locations lastObject]; [locationManager stopUpdatingLocation];

其中,currentLocation是CLLocation&类的实例。 locationManager是CLLocationManager类的实例。

然后你可以点击谷歌API:

NSString * url = [NSString stringWithFormat:@“https://maps.googleapis.com/maps/api/place/search/json?location=%@,%@&radius=%@&types=%@&sensor=false&key=%@”,StrCurrentLatitude,StrCurrentLongitude,@“2000”,@“restaurant”,kGOOGLE_API_KEY];

并管理JSON响应..这对我有用.. :))

相关问题