iOS の既定のマップ アプリで 2 つの場所の間の方向を取得する機能を実装したいのですが、これを試しました
Class itemClass = [MKMapItem class];
if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {
// Use iOS 6 maps
NSString *latString = @"23.0300";
NSString *longString = @"72.5800";
CLLocationCoordinate2D ctrpoint;
ctrpoint.latitude = [latString doubleValue];
ctrpoint.longitude = [longString doubleValue];
MKPlacemark *placemark2 = [[MKPlacemark alloc] initWithCoordinate:ctrpoint addressDictionary:nil];
MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark2];
[mapItem openInMapsWithLaunchOptions:nil];
}
ただし、以下のように方向エラーが表示されます。
地図アプリを開いて、現在地を特定し、現在地に最も近い地図にピンを 1 つ追加しましたが、それでも方向を取得できません。
また、「要するに、ネイティブアプリでもGet Directionが完全に機能していません」これを達成するのを手伝ってくれる人はいますか?