2013-08-20 53 views
2

我试图按照newMeRequest这部分的美味教程,请求永不返回,代码如下例所示。我错过了什么?谢谢?facebook android sdk,newMeRequest永不返回

private void makeMeRequest(final Session session) { 
     // Make an API call to get user data and define a 
     // new callback to handle the response. 
     Request request = Request.newMeRequest(session, 
       new Request.GraphUserCallback() { 
        @Override 
        public void onCompleted(GraphUser user, Response response) { 
         // If the response is successful 
         if (BuildConfig.DEBUG){ 
          Log.i(TAG, "GraphUserCallback" + user.getId()+" " + response.toString()); 

         } 
         if (session == Session.getActiveSession()) { 
          if (user != null) { 
           // Set the id for the ProfilePictureView 
           // view that in turn displays the profile picture. 
           //profilePictureView.setProfileId(user.getId()); 
           profilePictureView.setId(Integer.parseInt(user.getId())); 
           // Set the Textview's text to the user's name. 
           userNameView.setText(user.getName()); 
          } 
         } 
         if (response.getError() != null) { 
          // Handle errors, will do so later. 
         } 
        } 
       }); 
     request.executeAsync(); 
    } 

回答

3

请确保您添加此权限

<uses-permission android:name="android.permission.INTERNET"/> 
+0

OMG我无法相信我错过的那部分。 Tks :) –

相关问题