這裏是我的代碼來整合Facebook與Android應用程序(parse.com)。整合Facebook +解析在Android應用程序中的錯誤
請找到下面的代碼和堆棧trace.here試圖從解析驗證FB用戶。
當你點擊login with Facebook
選擇應用程序崩潰。任何建議將不勝感激。
private void onLoginButtonClicked() {
// TODO Auto-generated method stub
LoginActivity.this.progressDialog = ProgressDialog.show(
LoginActivity.this, "", "Logging in...", true);
List<String> permissions = Arrays.asList("basic_info", "user_about_me",
"user_relationships", "user_birthday", "user_location");
// ParseFacebookUtils.initialize(appId);
ParseFacebookUtils.logIn(permissions, this, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
LoginActivity.this.progressDialog.dismiss();
if (user == null) {
Log.d(IntegratingFacebookTutorialApplication.TAG,
" user cancelled the Facebook login.");
} else if (user.isNew()) {
Log.d(IntegratingFacebookTutorialApplication.TAG,
"User signed up and logged in through Facebook!");
showUserDetailsActivity();
} else {
Log.d(IntegratingFacebookTutorialApplication.TAG,
"User logged in through Facebook!");
showUserDetailsActivity();
}
}
});
}
日誌
09-24 18:33:35.809: E/AndroidRuntime(641): FATAL EXCEPTION: main
09-24 18:33:35.809: E/AndroidRuntime(641): java.lang.IllegalStateException: You must call ParseFacebookUtils.initialize() before using ParseFacebookUtils
09-24 18:33:35.809: E/AndroidRuntime(641): at com.parse.ParseFacebookUtils.checkInitialization(ParseFacebookUtils.java:88)
09-24 18:33:35.809: E/AndroidRuntime(641): at com.parse.ParseFacebookUtils.logIn(ParseFacebookUtils.java:331)
09-24 18:33:35.809: E/AndroidRuntime(641): at com.parse.ParseFacebookUtils.logIn(ParseFacebookUtils.java:355)
09-24 18:33:35.809: E/AndroidRuntime(641): at com.tukutane.LoginActivity.onLoginButtonClicked(LoginActivity.java:168)
09-24 18:33:35.809: E/AndroidRuntime(641): at com.tukutane.LoginActivity.onClick(LoginActivity.java:154)
09-24 18:33:35.809: E/AndroidRuntime(641): at android.view.View.performClick(View.java:4084)
09-24 18:33:35.809: E/AndroidRuntime(641): at android.view.View$PerformClick.run(View.java:16966)
09-24 18:33:35.809: E/AndroidRuntime(641): at android.os.Handler.handleCallback(Handler.java:615)
09-24 18:33:35.809: E/AndroidRuntime(641): at android.os.Handler.dispatchMessage(Handler.java:92)
09-24 18:33:35.809: E/AndroidRuntime(641): at android.os.Looper.loop(Looper.java:137)
09-24 18:33:35.809: E/AndroidRuntime(641): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-24 18:33:35.809: E/AndroidRuntime(641): at java.lang.reflect.Method.invokeNative(Native Method)
09-24 18:33:35.809: E/AndroidRuntime(641): at java.lang.reflect.Method.invoke(Method.java:511)
09-24 18:33:35.809: E/AndroidRuntime(641): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-24 18:33:35.809: E/AndroidRuntime(641): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-24 18:33:35.809: E/AndroidRuntime(641): at dalvik.system.NativeStart.main(Native Method)
中的onCreate綁這個(); Parse.initialize(這一點, 「ASFolIoL4cWIs7pxHzbGOLR0Kj0LQ7f1tQGh4HwR」, \t \t \t \t 「8HXvQPTaSQWuUJKjJyn6OMFU1snfL8iO8qX0HmKJ」); \t \t ParseAnalytics.trackAppOpened(getIntent()); 什麼? – user1987430
@ user1987430你做Parse.initialize()NOT ParseFacebookUtils.initialize() –
@ user1987430僅供參考,我知道它的六個月中下旬左右,但你應該永遠不離開你的應用程序ID /客戶端密鑰,這樣的消息。可能是一個真正的糟糕時間,如果有人得到這個,他們想惡作劇/惡作劇在你的應用程序。 – CBanga