是否可以在iOS上直接进入Apple Maps应用程序中的业务信息页面?
我正在编写一个应用程序,其中包括各种场馆的信息。我想让用户能够从Apple Maps应用程序中打开位置信息屏幕。我知道如何使用如下代码让应用程序打开MKMapItem:是否可以在iOS上直接进入Apple Maps应用程序中的业务信息页面?,ios,mapkit,openurl,apple-maps,Ios,Mapkit,Openurl,Apple Maps,我正在编写一个应用程序,其中包括各种场馆的信息。我想让用户能够从Apple Maps应用程序中打开位置信息屏幕。我知道如何使用如下代码让应用程序打开MKMapItem: - (void) showMoreInfoFor:(MKPlacemark*) destination { MKLocalSearchRequest* searchRequest = [[MKLocalSearchRequest alloc] init]; searchRequest.naturalLanguag
- (void) showMoreInfoFor:(MKPlacemark*) destination {
MKLocalSearchRequest* searchRequest = [[MKLocalSearchRequest alloc] init];
searchRequest.naturalLanguageQuery = self.venue.name;
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(destination.coordinate, 50.0f, 50.0f);
searchRequest.region = region;
MKLocalSearch* search = [[MKLocalSearch alloc] initWithRequest:searchRequest];
[search startWithCompletionHandler:^(MKLocalSearchResponse *response, NSError *error) {
if ([response.mapItems count] > 0) {
[[response.mapItems objectAtIndex:0] openInMapsWithLaunchOptions:nil];
}
}];
}
(我还尝试跳过本地搜索,直接用目的地placemark创建一个新的MKMapItem,结果完全相同。)
但是,这会将用户带到如下屏幕:
我更希望用户直接进入下面的屏幕,而不是要求用户点击位置标记上的显示指示器
我还尝试过使用Apple maps链接(根据),如下所示:
NSString* url = [NSString stringWithFormat:@"http://maps.apple.com/?sll=%f,%f&q=%@", destination.coordinate.latitude, destination.coordinate.longitude, [self.venue.name stringByReplacingOccurrencesOfString:@" " withString:@"+"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
但这会将用户带到与上面第一个屏幕类似的屏幕,只是在许多情况下,它显示的pin与URL中指定的lat/lon相差甚远(例如,在完全不同的城市)。它也不会深入到位置信息屏幕
是否可以从iOS应用程序导航到Apple Maps应用程序,直接进入上面第二个屏幕截图所示的业务/位置信息屏幕?这里是一个建议。官方文件表明,这些链接可以同时指向safari和apple地图。尝试通过safari导航,并查看可以给您提示的链接(在业务页面上)。