2017-12-31 50 views
0

GraphUser가 사용 중지되었는지 알려줄 수 있습니까? 그렇다면 GraphResponse에서 GraphUser (또는 사용자 객체)를 얻을 수있는 대체 방법은 무엇입니까?'com.facebook.android:facebook-android-sdk:4.27.0'로 GraphUser를 해결할 수 없습니다.

참고 : 다음 종속성을 시도했지만 해결할 수 없습니다. 'com.facebook.android:facebook-android-sdk:4.27.0'

건배

+0

시도 의존성'컴파일은 'com.facebook.android : 페이스 북 - 안드로이드 SDK를 : 4.8.2''. – ADM

+0

그것도 시도했지만 여전히 운이 없다 : ( – channae

답변

0

내가 response.getRawResponse로 JSON에 GraphResponse 변환 결국에보십시오) . GraphResponse 내에서 사용자 데이터가 당신이 전달하는 쿼리에 따라 동적 일 수 있기

public void onCompleted(GraphResponse response) { 
        Log.d("mylog", response.toString()); 
        try { 
         JSONObject json = new JSONObject(response.getRawResponse()); 
         JSONArray jarray = json.getJSONArray("data"); 

         for (int i = 0; i < jarray.length(); i++) { 
          JSONObject jsonUser = jarray.getJSONObject(i); 
          //get your values 
          String fullName = jsonUser.getString("name"); 
          String id = jsonUser.getString("id") 

          JSONObject pictureData = jsonUser.getJSONObject("picture").getJSONObject("data"); 
          Uri url = Uri.parse(pictureData.getString("url")); 
         } 

        } catch (JSONException e) { 
         e.printStackTrace(); 
        } 
} 

아래에 주어진 그럼 난 JSON에서 값을 추출 (예 : "/ ME/친구 필드 = 사진, 이름, ID") , 이것이 최고의 솔루션입니다.

감사합니다,

0

(

compile 'com.facebook.android:facebook-android-sdk:4.7.0' 
+0

시도해도 여전히 운이 없다. – channae

관련 문제