How do i open Google Maps for directions using coordinates on the iphone

后端 未结 7 1911
礼貌的吻别
礼貌的吻别 2020-12-12 18:29

I am using UIMapView to display locations on the iPhone. I want to do a directions from current location to the location of interest, I don\'t think its possible using MapKi

7条回答
  •  温柔的废话
    2020-12-12 19:09

    First check google map is installed in device or not

    if ([[UIApplication sharedApplication] canOpenURL:
             [NSURL URLWithString:@"comgooglemaps://"]]) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"comgooglemaps://?saddr=23.0321,72.5252&daddr=22.9783,72.6002&zoom=14&views=traffic"]];
        } else {
            NSLog(@"Can't use comgooglemaps://");
        }
    

    Add query schema in .plist

    LSApplicationQueriesSchemes
    
     comgooglemaps
    
    

提交回复
热议问题