2013-02-14 151 views
4

我正在使用Facebook SDK 2.0。今天我已經更新Facebook的SDK到3.0。但是有登錄問題。 當我點擊一次又一次登錄按鈕,一個或兩個時間,10到12個適當的登錄對話框打開,但其他嘗試失敗。這裏是我的代碼:登錄問題使用Facebook的SDK 3.0 for Android

Util.clearCookies(getApplicationContext()); 
      String response = ""; 
      if (!response.contains("Error")) { 
       SharedPreferences prefs = main.this.getSharedPreferences("userInformation", Context.MODE_PRIVATE); 
       SharedPreferences.Editor editor = prefs.edit(); 
       editor.putString("ImageURL", null); 
       editor.commit(); 
       //SessionStore.clear(main.this); 

       loginSuccess = false; 
       // do 
       BLL_Friendlist chatFriendDataSource = new BLL_Friendlist(mActivity); 
       chatFriendDataSource.deleteAllRecordsInFriendList(); 

       userImage.setImageUrl(null); 
       dummy_user_Image_view.setVisibility(View.VISIBLE); 

       ///////////////////////// 

       mFacebook = new Facebook(APP_ID); 

       Session.waitForAuthCallback(mFacebook); 

       mFacebook.authorize(main.this, PERMISSIONS, new AppLoginListener(mFacebook)); 

       mAsyncRunner = new AsyncFacebookRunner(mFacebook); 

       SessionStore.restore(mFacebook, getApplicationContext()); 

       SessionEvents.addAuthListener(new SampleAuthListener()); 
       SessionEvents.addLogoutListener(new SampleLogoutListener()); 

代碼有什麼問題?

enter image description here

+0

試試這個http://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/ – 2013-02-27 06:01:59

回答

0

首先,如果你沒有Android設備上的Facebook應用程序登錄屏幕需要一段時間。 和第二個: SessionStore.restore(mFacebook,getApplicationContext());如果您之前沒有連接過,則無法工作。

相關問題