麻烦驳回MapKit iOS6的

麻烦驳回MapKit iOS6的

问题描述:

我使用此代码在iOS6的创建驾驶模式方向:麻烦驳回MapKit iOS6的

Class itemClass = [MKMapItem class]; 

    if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) { 
     MKMapItem *currentLocationItem = [MKMapItem mapItemForCurrentLocation]; 
     NSString *Latitude = [[_locationString componentsSeparatedByString:@","] objectAtIndex:0]; 
     NSString *Longitude = [[_locationString componentsSeparatedByString:@","] objectAtIndex:1]; 
     MKPlacemark *place = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake([Latitude doubleValue], [Longitude doubleValue]) addressDictionary:nil]; 
     MKMapItem *destinamtionLocItem = [[MKMapItem alloc] initWithPlacemark:place]; 

     destinamtionLocItem.name = _titleString; 

     NSArray *mapItemsArray = @[currentLocationItem, destinamtionLocItem]; 
     NSDictionary *dictForDirections = @{MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving}; 

     [MKMapItem openMapsWithItems:mapItemsArray launchOptions:dictForDirections]; 
} 

的问题是,的导航栏总是隐藏任何按钮关闭该视图返回到您的应用程序。那么,如何解散MapKit drivingMode?

enter image description here

你误会了openMapsWithItems在做什么。该用户已不在您的应用中。你已经将它们发送到Apple的Map.app。解除它的唯一方法是用户按主页按钮。

@Marckaraujo:我完全同意@craig。一旦您在应用程序中使用行车路线模式,就没有办法回到应用程序。您只需按下home按钮,然后回到您离开的位置应用。

我也遇到过这个问题,并且搜索了很多,但这只是最终的解决方案。主页按钮。