【问题标题】:Nearby place finiding Google MAP SDK确定 Google MAP SDK 的附近地点
【发布时间】:2013-09-12 09:53:14
【问题描述】:

我在我的应用程序中使用了 GOOGLE MAP SDK for ios 而不是苹果地图。我已经通过 google API 调用来查找附近的餐厅。但是没有提到如何在适用于 ios 的 Google MAP SDK 中使用 google 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;
}

我应该在哪里使用 google API 来查找附近的 returants 使用

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];

请帮我解决!

【问题讨论】:

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


【解决方案1】:

在 CLLocationManagerDelegate 中,函数:

-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations

一旦你通过 currentLocation = [位置 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 响应.. 这对我有用.. :)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-12
    • 1970-01-01
    • 2018-03-03
    • 1970-01-01
    • 2016-07-14
    • 2015-12-24
    相关资源
    最近更新 更多