从GMSPlace placeID获取GMSAddress

Viv*_*kar 2 google-maps ios

有没有办法GSMAddress从placeID 获取.我有兴趣使用placeIDautocompleteQuery方法获得的地址.

PS:我有一个placeID并且GMSAddress在iOS中找到相应的方法.

我在这里找到了一个帖子,但这没有帮助.

谢谢,

ben*_*igi 5

自动完成后,我们查找一个地方,然后将坐标传递给GM​​SGeocoder以检索详细信息,但我仍然缺少street_name和street_number.

CLLocationCoordinate2D addressCoordinates = CLLocationCoordinate2DMake(latitude,longitude);

GMSGeocoder* coder = [[GMSGeocoder alloc] init];
[coder reverseGeocodeCoordinate:addressCoordinates completionHandler:^(GMSReverseGeocodeResponse *results, NSError *error) {

    if (error) {
        NSLog(@"Error %@", error.description);
    } else {
        GMSAddress* address = [results firstResult];
        NSLog(@"thoroughfare %@",address.thoroughfare);
        NSLog(@"locality %@",address.locality);
        NSLog(@"subLocality %@",address.subLocality);
        NSLog(@"administrativeArea %@",address.administrativeArea);
        NSLog(@"postalCode %@",address.postalCode);
        NSLog(@"country %@",address.country);
        NSLog(@"lines %@",address.lines);
    }
}];
Run Code Online (Sandbox Code Playgroud)

我正在考虑切换到iOS自己的反向地理编码器.

[CLGeocoder reverseGeocodeLocation:[[CLLocation alloc] initWithLatitude:latitude longitude:longitude] completionHandler:
 ^(NSArray* placemarks, NSError* error) {
Run Code Online (Sandbox Code Playgroud)