gpt4 book ai didi

android - 在 Android 应用程序中集成 Facebook+Parse 时出错

转载 作者:行者123 更新时间:2023-11-29 14:50:46 25 4
gpt4 key购买 nike

这是我将 Facebook 与 Android 应用程序 (parse.com) 集成的代码。

请在下面找到代码和堆栈跟踪。此处尝试通过解析对 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)

最佳答案

你必须调用它

ParseFacebookUtils.initialize(appId);

之前

ParseFacebookUtils.logIn();

关于android - 在 Android 应用程序中集成 Facebook+Parse 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18982625/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com