2013-01-02 66 views
0

我正在使用Apple Maps API編寫應用程序。我想按照Google服務的查詢指示(https://developers.google.com/maps/documentation/directions/?hl=vi)顯示用戶和朋友路線。從服務中獲取數據後,我使用MKPolyline(iOS SDK中的類)在Apple地圖上顯示路線。這是可能的,而不是與蘋果和谷歌的政策衝突?是否可以將Apple Direction API與Apple Maps一起使用?

期待您的回覆。

感謝

回答

4

IIRC,谷歌的地圖API服務條款明確禁止使用其數據服務與其他人的地圖。


更新:在iOS系統7和後,MapKit具有用於獲取路線(和渲染所得路由)的API。請參閱MKDirections和相關文檔。

+0

那麼這對我來說是個壞消息:-( – haisergeant

+0

那麼,有沒有爲方向API的任何替代方案? – haisergeant

+0

MapQuest的有方向的API – jmstone617

1

是,可以使用谷歌API的方向與蘋果地圖...在iOS6的下面的示例代碼試試這個希望你有幫助...

CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake([_iLat doubleValue],[_iLong doubleValue]); 

//create MKMapItem out of coordinates 
MKPlacemark* placeMark = [[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil]; 
MKMapItem* destination = [[MKMapItem alloc] initWithPlacemark:placeMark]; 

if([destination respondsToSelector:@selector(openInMapsWithLaunchOptions:)]) 
{ 
    //using iOS6 native maps app 
    [destination openInMapsWithLaunchOptions:@{MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving}]; 

} 
相關問題