CMMapLauncher是一个iOS小库,可以快速、轻松地在各种地图应用中显示方向。要使用它,只需将CMMapLauncher.h
和CMMapLauncher.m
添加到您的项目中即可。
要检查是否在用户的设备上存在支持的地图应用程序
BOOL installed = [CMMapLauncher isMapAppInstalled:CMMapAppCitymapper];
然后,在应用程序中启动方向
CLLocationCoordinate2D bigBen = CLLocationCoordinate2DMake(51.500755, -0.124626);
[CMMapLauncher launchMapApp:CMMapAppCitymapper
forDirectionsTo:[CMMapPoint mapPointWithName:@"Big Ben"
coordinate:bigBen]];
CMMapLauncher目前知道如何在以下地图应用程序中显示方向
CMMapAppAppleMaps
CMMapAppCitymapper
CMMapAppGoogleMaps
CMMapAppNavigon
CMMapAppTheTransitApp
CMMapAppWaze
CMMapAppYandex
如果您知道其他提供方向且公开URL方案以从其他应用程序启动的应用程序,该项目希望将它们整合进来!欢迎提供URL方案的Pull requests和issue。
CMMapLauncher最初由Citymapper创建,但现在作为MIT许可证发布,以惠及iOS开发者社区。