2015-09-06 62 views
1

在我的iOS应用程序,我有谷歌地图SDK和我使用的是GMSPlacePicker挑选周围的地方具体坐标是​​这样的:GMSPlace - 坐标财产丢失 - iOS版SDK

//center is a CLLocationCoordinate2D 

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]); 
        } 
        else if (place) { 

         CLLocationCoordinate2D c = place.coordinate; 
         //place.coordinate doesn't exist 

        } 

     }]; 

但是没有地方.coordinate财产,尽管谷歌指出有here 任何想法,为什么这是缺少?

+0

你有没有得到任何解决方案? – UserDev

回答

0

我在Swift工作,但这可能会有所帮助。 GMSPlace的'坐标'属性是可选的,因此可能不需要有价值。你能检查它的存在吗?

作为解决方法,我使用基于'googlePlaceID'的'lookupPlaceID'调用来查找坐标,但它需要额外的API调用。