我正在使用 Facebook SDK 登录 Facebook 帐户...尝试登录后出现白屏并卡在上面。这是我的代码:`public class MainActivity extends Activity implements OnClickListener{
Facebook fb;
ImageView pic, button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Toast.makeText(MainActivity.this, "", Toast.LENGTH_SHORT).show();
String APP_ID = "151170088390760"; // getString(R.string.APP_ID);
fb = new Facebook(APP_ID);
button = (ImageView) findViewById(R.id.login);
pic = (ImageView) findViewById(R.id.profile_pic);
button.setOnClickListener(this);
updateButtonImage();
}
private void updateButtonImage() {
if(fb.isSessionValid()) {
button.setImageResource(R.drawable.logout_button);
}else {
button.setImageResource(R.drawable.login_button);
}
}
@Override
public void onClick(View v) {
if(fb.isSessionValid()) {
try {
fb.logout(getApplicationContext());
updateButtonImage();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
// login to facebook
fb.authorize(MainActivity.this, new DialogListener(){
@Override
public void onFacebookError(FacebookError e) {
Toast.makeText(MainActivity.this, "onFacebookError()", Toast.LENGTH_SHORT).show();
}
@Override
public void onError(DialogError e) {
Toast.makeText(MainActivity.this, "onError()", Toast.LENGTH_SHORT).show();
}
@Override
public void onComplete(Bundle values) {
updateButtonImage();
Toast.makeText(MainActivity.this, "onComplate()", Toast.LENGTH_SHORT).show();
}
@Override
public void onCancel() {
Toast.makeText(MainActivity.this, "onCancel()", Toast.LENGTH_SHORT).show();
}
});
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
fb.authorizeCallback(requestCode, resultCode, data);
}
` 我多次确认了 Keystore,并且我已将我的应用程序注册到 facebook 开发者网站,感谢您的帮助 :) 这是白屏图片:
注意:我使用的是 Facebook SDK 3.0.1
问题已解决:因为我尝试从未作为开发人员签名的其他 Facebook 帐户登录
谢谢你