代码
- (void)callGoogleMap :(NSString*)place
{
CLGeocoder *gencoder = [[CLGeocoder alloc]init];
[gencoder geocodeAddressString:place completionHandler:^(NSArray *placemarks,NSError *error){
//编码结束后返回的是CLPlacemark实例的集合
CLPlacemark *placemark = placemarks[0];
//获得当前CLPlacemark实例的经纬度
CLLocationCoordinate2D coordinate = placemark.location.coordinate;
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%f,%f",coordinate.latitude,coordinate.longitude];
NSURL *url = [NSURL URLWithString:urlString];
[[UIApplicationsharedApplication]openURL:url];
}];
}
在模拟器当中模拟自己的位置,然后目标位置通过参数进行传递