2014-03-18 2 views
1

다음 코드에서 Venue 이름을 가져 오려고하지만 오류가 계속 발생하려고합니다. 그것의 명백한 스 니펫에는 논리적 인 오류가 있습니다. 데이터를 표시하려면 어떻게해야합니까?VenuesExplore의 문제점은 무엇입니까?

String callbackUrl = "https://developer.foursquare.com/docs/samples/explore?client_id=6666666&v=20140101&ll=43,-79&client_secret=55555555";

FoursquareApi foursquareApi = new FoursquareApi(clientId, client_Secret, callbackUrl); 

    Result<Recommended> result = foursquareApi.venuesExplore(ll, null, null, null, null,null,query, null, null); 
     if (result.getMeta().getCode() == 200) 
    { 

     for (RecommendationGroup venue : result.getResult().getGroups()) 
     { 
      for(Recommendation r: venue.getItems()) 
      { 
       CompactVenue cmp = r.getVenue(); 
       System.out.println(cmp.getName()); 
      } 

     } 
    } 
     else 
    { 
     System.out.println("Error occured: "); 
     System.out.println(" code: " + result.getMeta().getCode()); 
     System.out.println(" type: " + result.getMeta().getErrorType()); 
     System.out.println(" detail: " + result.getMeta().getErrorDetail()); 
    } 

프로그램을 실행할 때 아무 것도 표시되지 않습니다. 그래서 논리적 오류라고 생각합니다.

+1

정확한 오류에 관해 구체적으로 설명해 줄 수 있습니까? 스택 추적이 도움이 될 것입니다. – octopi

답변

0

동일한 오류가 발생했습니다. 나를 위해 FoursquareApi의 venuesExplore() 메소드를 변경하는 데 도움이되었습니다.

public Result<Recommended> venuesExplore(String ll, Double llAcc, Double alt, Double altAcc, Integer radius, String section, String query, Integer limit, String basis) throws FoursquareApiException {..} 

json 구문 분석에 문제가있는 것으로 보입니다. 그래서 나는 변경 :

KeywordGroup keywords = (KeywordGroup) JSONFieldParser.parseEntity(KeywordGroup.class, response.getResponse().getJSONObject("keywords"), this.skipNonExistingFields); 

에 :

KeywordGroup keywords = new KeywordGroup(); 

그래서 결과에는 키워드 만 응답 IST의 나머지를 잘 분석하지 않습니다.

관련 문제