iOS操作表调用外部谷歌地图应用程序和引脚标记



我需要的是,通过使用操作表委派将纬度和液化天然气信息从我自己的应用程序发送到谷歌地图应用程序,并使用提供的纬度液化天然气参数,谷歌地图可以绘制一个图钉(标记(

这是我的代码

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    //coordinates for the place we want to display
    CLLocationCoordinate2D mosqueLocation = CLLocationCoordinate2DMake(lat,lng);
    if (buttonIndex==0) {
        //Apple Maps, using the MKMapItem class
        MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:mosqueLocation addressDictionary:nil];
        MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark];
        item.name = navBarTitle.title;
        [item openInMapsWithLaunchOptions:nil];
    } else if (buttonIndex==1) {
        //Google Maps
        //construct a URL using the comgooglemaps schema
        NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"comgooglemaps://?center=%f,%f",mosqueLocation.latitude,mosqueLocation.longitude]];
        if (![[UIApplication sharedApplication] canOpenURL:url]) {
            NSLog(@"Google Maps app is not installed");
              } else {
            [[UIApplication sharedApplication] openURL:url];
        }
    }
}

如您所见,我已成功绘制带有红色图钉的Apple地图,但我不知道如何使用ComGoogleMap URLSCHEME在Google地图上绘制相同的图钉。

LAT和LNG提供,只需要发送到谷歌地图应用程序进行抽奖,任何建议都会非常有帮助,代码示例更好,谢谢

添加对坐标的搜索以显示该位置的标记:

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]]) {
  NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"comgooglemaps://?center=%f,%f&q=%f,%f",mosqueLocation.latitude,mosqueLocation.longitude, mosqueLocation.latitude,mosqueLocation.longitude]];
  [[UIApplication sharedApplication] openURL:url];
} else {
  NSLog(@"Can't use comgooglemaps://");
}