我在 Facebook 中创建了一个带有用户身份验证的应用程序。但是当我最小化、恢复然后注销 Facebook 时,它会抛出以下错误。
07-13 16:35:42.989: E/AndroidRuntime(23464): FATAL EXCEPTION: Thread-47
07-13 16:35:42.989: E/AndroidRuntime(23464): android.database.sqlite.SQLiteDiskIOException: error code 10: disk I/O error
07-13 16:35:42.989: E/AndroidRuntime(23464): at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
07-13 16:35:42.989: E/AndroidRuntime(23464): at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:61)
07-13 16:35:42.989: E/AndroidRuntime(23464): at android.database.sqlite.SQLiteDatabase.delete(SQLiteDatabase.java:1632)
07-13 16:35:42.989: E/AndroidRuntime(23464): at android.webkit.WebViewDatabase.clearCookies(WebViewDatabase.java:543)
07-13 16:35:42.989: E/AndroidRuntime(23464): at android.webkit.CookieSyncManager.clearAllCookies(CookieSyncManager.java:128)
07-13 16:35:42.989: E/AndroidRuntime(23464): at android.webkit.CookieManager$2.run(CookieManager.java:532)
07-13 16:35:42.989: E/AndroidRuntime(23464): at java.lang.Thread.run(Thread.java:1019)
产生错误的代码是
private void fbLogout() {
dialog.setMessage("Disconnecting from Facebook");
dialog.show();
new Thread() {
@Override
public void run() {
Log.v("fbLogout() Clear", "fbLogout() Clear");
SessionStore.clear(getParent());
int what = 1;
try {
Log.v("fbLogout() Clear", "fbLogout() before logout()");
mFacebook.logout(getParent());
Log.v("fbLogout() Clear", "fbLogout()after logout()");
what = 0;
} catch (Exception ex) {
ex.printStackTrace();
}
mHandler.sendMessage(mHandler.obtainMessage(what));
}
}.start();
}
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
dialog.dismiss();
if (msg.what == 1) {
Toast.makeText(getParent(), "Facebook logout failed", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getParent(), "Disconnected from Facebook", Toast.LENGTH_SHORT).show();
}
}
};
public String logout(Context context)
throws MalformedURLException, IOException {
Util.clearCookies(context);
Bundle b = new Bundle();//Generates Error
b.putString("method", "auth.expireSession");//Generates Error
String response = request(b);
setAccessToken(null);
setAccessExpires(0);
return response;