2011-12-24 62 views

回答

4

當然。只要做這樣的事情:

NSXMLParser * xmlParser = 
    [[NSXMLParser alloc] initWithContentsOfURL: [NSURL URLWithString: @"http://maps.googleapis.com/maps/api/directions/xml?origin=Toronto,ON&destination=Manhattan,NY&dirflg=r&sensor=false"]; 

Apple documentation for NSXMLParser is here

這可能對您的目的有點太重,所以您也可以做一些類似answers provided for in this duplicate question的事情。

+0

啊,太好了。你碰巧知道爲什麼'dirflg = r'參數(切換到公共交通)不起作用? – c0d3Junk13 2011-12-24 17:30:20

+0

不是我的頭頂,但發佈了一個不同的問題,我或其他人可以爲你提供一個快速的答案。 – 2011-12-24 19:40:07