【发布时间】:2014-03-31 16:40:08
【问题描述】:
我是 iOS 新手,我想从我自己的应用程序中运行导航应用程序。现在我只使用这个代码:
- (void)navigationButtonTap:(id)sender
{
Class mapItemClass = [MKMapItem class];
if (mapItemClass && [mapItemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)])
{
// Create an MKMapItem to pass to the Maps app
CLLocationCoordinate2D coordinate =
CLLocationCoordinate2DMake([actualPlace.latitude doubleValue], [actualPlace.longitude doubleValue]);
MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:coordinate
addressDictionary:nil];
MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
[mapItem setName:actualPlace.Name];
// Pass the map item to the Maps app
[mapItem openInMapsWithLaunchOptions:nil];
}
}
它正在工作,我知道如何更改它以在导航启动的情况下运行 Apple 地图。没关系,但现在我正在考虑一些第 3 方选项。与谷歌地图等其他导航应用程序的情况如何? iOS用户可以将它们设置为默认并使用它们吗?如何为用户提供启动他想要的应用程序的选项?
我找到了code for implementing Google Maps 选项。但它与 Apple 地图的代码不同。我可以为所有导航应用程序使用相同的代码,然后用户决定运行哪个应用程序吗?
【问题讨论】:
标签: ios objective-c google-maps ios7