我正在尋找將距離計算器添加到我的應用程序。我一直在尋找谷歌的API,我似乎無法解碼JSON。我已經設法用PHP來做到這一點。代碼爲:在iPhone上提取JSON respose的特定部分
substr($convertedtoarray['routes']['0']['legs']['0']['distance']['text'], 0, -3);
在iPhone上,我設法得到JSON響應,但無法獲得我想要的特定部分。
的Json地址:http://maps.googleapis.com/maps/api/directions/json?origin=plymouth&destination=pl210bp&sensor=false
NSMutableDictionary *luckyNumbers = [responseString JSONValue];
[responseString release];
if (luckyNumbers != nil) {
NSString *responseStatus = [luckyNumbers objectForKey:@"routes"];'
}
會在哪裏我該何去何從?
任何幫助將是巨大的歡呼聲
謝謝,這就是我之後!乾杯! – dan 2011-05-02 17:26:27