iOS에서 mapquest 지오 코드 json을 구문 분석하려고하지만 NSJSONSterilization이 null을 반환합니다. 온라인 json checkers로 확인한 결과 URL이 사실 json 인 것 같습니다. 여기 iOS의 MapQuest JSON에 대해 NSJSONSerialization이 null을 반환합니다.
는NSJSONSerialization
if(geocodeResponseData)
{
NSLog(@"there is response data");
//this is logged.
}
NSDictionary *mapQuestReponse = [NSJSONSerialization
JSONObjectWithData:geocodeResponseData
options:kNilOptions
error:&error];
NSLog(@"mapquestreponse %@", mapQuestReponse);
이 구문 분석 반환되는 JSON
URL 인 코드입니다.
http://www.mapquestapi.com/geocoding/v1/batch?key=API----KEY----HIDDEN----&callback=renderBatch&outFormat=json&location=14443%20C%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14510%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14550%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14515%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=1480%20S%20De%20Anza%20Blvd,San%20Jose,%20CA%2095129&location=1600%20S%20De%20Anza%20Blvd,San%20Jose,%20CA%2095129&location=18486%20Prospect%20Rd,San%20Jose,%20CA%2095070&location=14572%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=5210%20Prospect%20Rd,San%20Jose,%20CA%2095129&location=1600%20S%20De%20Anza%20Blvd,San%20Jose,%20CA%2095106&location=14480%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=1818%20Saratoga%20Ave,San%20Jose,%20CA%2095129&location=18562%20Prospect%20Rd,Saratoga,%20CA%2095070&location=14560%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14420%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=1075%20S%20De%20Anza%20Blvd,Cupertino,%20CA%2095129&location=18802%20Cox%20Ave,Saratoga,%20CA%2095070&location=6154%20Bollinger%20Rd,San%20Jose,%20CA%2095129&location=14555%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14000%20Fruitvale%20Ave,Saratoga,%20CA%2095070
는 때문에
utf-8
의
NULL
을 반환? 미리 감사드립니다.
당신은 정확하고 좋은 답변입니다. 또한 [JSONLint] (http://jsonlint.com/) –
덕분에 렌더링이 사라졌습니다. 새 JSON 브라우저에서 괜찮아 보이지만 NSJSONSterilization 여전히 null을 반환합니다. – Spenciefy
저에게 잘 작동합니다 : http://i.imgur.com/l3ejVzt.png –