iphone - 从 iOS 6 中的应用程序映射应用程序后如何返回我的应用程序

标签 iphone ios map apple-maps mkmapitem

我正在使用此代码在 map 上显示一些位置。

Class mapItemClass = [MKMapItem class];
if (mapItemClass && [mapItemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)])
{
    // Create an MKMapItem to pass to the Maps app
    CLLocationCoordinate2D coordinate =
    CLLocationCoordinate2DMake(37.789658,-122.417479);
    MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:coordinate
                                                   addressDictionary:nil];
    MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
    [mapItem setName:@"My Place"];

    // Set the directions mode to "Walking"
    // Can use MKLaunchOptionsDirectionsModeDriving instead
    NSDictionary *launchOptions = @{MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving};
    // Get the "Current User Location" MKMapItem
    MKMapItem *currentLocationMapItem = [MKMapItem mapItemForCurrentLocation];
    // Pass the current location and destination map items to the Maps app
    // Set the direction mode in the launchOptions dictionary
    [MKMapItem openMapsWithItems:@[currentLocationMapItem, mapItem]
                   launchOptions:launchOptions];
}

此代码将我带到我的 iphone 中存在的苹果 map 应用程序,这没问题,但它不会将我带回我的应用程序。 如果有人知道实现此目的的任何解决方案,请建议我。 !!提前致谢。!!

最佳答案

很遗憾,您想要的无法完成。

一旦您将用户转到另一个应用,您的应用再次激活的唯一方法是该应用专门将用户返回到您的应用,或者让用户导航回您的应用。

截至目前, map 应用程序不会将用户返回到您的应用程序。您无能为力。

关于iphone - 从 iOS 6 中的应用程序映射应用程序后如何返回我的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15847011/

相关文章:

ios - 在 ASIFormDataRequest iOS dev 中获取异步响应和同步调用超时

iphone - 无法打开手工编码的plist文件

c++ - View Controller 中的 C 函数问题

map - 使用 Redis 服务 URL 映射到 nginx

不同类的 C++ Map<>.find() 重载

map - 悬停在特定国家/地区时,在空白世界地图上突出显示国旗

iphone - Social.framework 不适用于设备

ios - Flutter Xcode 构建失败 - 'TARGET_OS_WATCHOS' 未定义,计算结果为 0

ios - 您如何从您的 iOS 应用程序中完全获取 'close and clear' FBSession 的 activeSession 信息?

ios - ActionSheet 不断出现在每个按钮上