Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用Google places API获取附近地点的列表_Ios_Google Places - Fatal编程技术网

Ios 使用Google places API获取附近地点的列表

Ios 使用Google places API获取附近地点的列表,ios,google-places,Ios,Google Places,我正在做一个项目,它可以获取附近地方的列表(从我现在的地方)。我使用GooglePlacesAPI,我尝试过的如下所示。我看到了一个新的视图,它有一个地图视图,上面有最突出位置的标记,还有一个包含这些位置列表的表格。我需要获取位置列表,以便在我的tableview上呈现它 - (IBAction)pickPlace:(UIButton *)sender { CLLocationCoordinate2D center = CLLocationCoordinate2DMake(51.5108

我正在做一个项目,它可以获取附近地方的列表(从我现在的地方)。我使用GooglePlacesAPI,我尝试过的如下所示。我看到了一个新的视图,它有一个地图视图,上面有最突出位置的标记,还有一个包含这些位置列表的表格。我需要获取位置列表,以便在我的tableview上呈现它

  - (IBAction)pickPlace:(UIButton *)sender {
  CLLocationCoordinate2D center = CLLocationCoordinate2DMake(51.5108396, -0.0922251);
  CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(center.latitude + 0.001, center.longitude + 0.001);
  CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(center.latitude - 0.001, center.longitude - 0.001);
  GMSCoordinateBounds *viewport = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast                                                                   coordinate:southWest];
GMSPlacePickerConfig *config = [[GMSPlacePickerConfig alloc] initWithViewport:viewport];
  _placePicker = [[GMSPlacePicker alloc] initWithConfig:config];

  [_placePicker pickPlaceWithCallback:^(GMSPlace *place, NSError *error) {
    if (error != nil) {
      NSLog(@"Pick Place error %@", [error localizedDescription]);
      return;
    }

    if (place != nil) {
      NSLog(@"Place name %@", place.name);
      NSLog(@"Place address %@", place.formattedAddress);
      NSLog(@"Place attributions %@", place.attributions.string);
    } else {
      NSLog(@"No place selected");
    }
  }];
}

那么您就不应该使用
GMSPlacePicker
,因为它为您提供了用户界面,让您的用户进行单一选择。如果你想要一个可以自己显示的位置列表,那么你应该使用谷歌提供的REST界面来获取所需的详细信息并更新你的UI。

那么你不应该使用
GMSPlacePicker
,因为它为你提供了UI供你的用户进行单一选择。如果你想要一个可以自己显示的地点列表,那么你应该使用谷歌提供的REST界面来获取所需的详细信息并更新你的UI。

使用谷歌地点API可以获取附近地点的列表。我使用以下方法实现了同样的目标:

[GMSPlaceClient currentPlaceWithCallback:]

返回一个具有可能性的邻近位置数组。

可以使用Google places API获取邻近位置列表(从我当前的位置)。我使用以下方法实现了同样的目标:

[GMSPlaceClient currentPlaceWithCallback:]

返回一个可能的邻近位置数组。

您确定无法从mapView获取ID all places并将其传输到我自己的UITableView吗?地图视图是私有的,如果您确实访问了它,您可以访问它,但这不是解决问题的正确方法。我有API密钥。从Google Places API访问私有数据就足够了?地图视图是私有的-如
GMSPlacePicker
中所示,您无法访问它,或者如果找到一个位置列表…您确定无法从mapView获取所有位置的ID并传输到我自己的UITableView吗?地图视图是私有的,如果您确实访问了它,您可以,但这不是解决问题的正确方法我有API密钥。从Google Places API访问私有数据就足够了?地图视图是私有的-如
GMSPlacePicker
中所示,您无法访问它,或者如果找到一个位置列表。。。