使用地图应用程序iOS生成步行路线

截至目前,我使用以下代码从我的应用程序成功地使用地图应用程序生成路线:

NSString *formattedGroceryAddress = [[NSString stringWithFormat:@"%@",((EnhancedUIActionSheet *)actionSheet).grocery.address] stringByReplacingOccurrencesOfString:@" " withString:@"+"]; NSString *routeString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",localDataHelper.userLocation.coordinate.latitude,localDataHelper.userLocation.coordinate.longitude,formattedGroceryAddress]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:routeString]]; 

它会根据适当的驾驶路线打开地图应用程序。 事情是,我想打开地图默认步行方向。 也许我可以在我的请求中传递另一个参数来做到这一点。

任何人都知道如何?

谢谢 !

那么我想我应该更好地search之前问!

您可以将dirflg = w添加到请求中,并将在步行模式下启动地图应用程序。

这很有趣,因为苹果公司表示他们只支持几个Google地图参数,不包括这个参数,但实际上它似乎工作!

有关Google地图参数的更多信息: http : //mapki.com/wiki/Google_Map_Parameters
有关iOS应用的地图链接的更多信息: http : //developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html