无法访问Facebook会话 - 未知错误:无效的应用程序

3
我正在使用Prime31 SocialNetworking插件与Facebook SDK 3.5在Unity3D上,并尝试在Android 2.3.5设备上登录Facebook。在应用程序启动之前,我的设备上安装了Facebook应用程序并登录了Facebook用户。使用默认的登录行为SSO_WITH_FALLBACK。
当我从我的应用程序发起登录时,我观察到以下行为:
1. 应用程序启动时,Facebook会话处于CREATED状态。 2. 权限对话框提示我允许我的应用程序进行基本读取访问。 3. 我点击“确定”,然后显示我的主要应用程序活动,而不是Facebook的登录对话框(也许这是有意的,但是在Prime31插件中,在新的Session.OpenRequest(FacebookPlugin.getActivity())之前调用了Session.getActiveSession()。closeAndClearTokenInformation()和Session.setActiveSession(null))。 4. 我的应用程序的Facebook会话未打开(CLOSED_LOGIN_FAILED状态)。 logcat向我报告了这些行(包名称和Facebook应用程序ID已被替换):
I/Prime31 ( 5077): FacebookPlugin: openActiveSession.call with state: CLOSED_LOGIN_FAILED, exception: com.facebook.FacebookException: Log in attempt aborted.
I/Prime31 ( 5077): session state: OPENING
I/ActivityManager( 1444): Starting activity: Intent { act=SSO_WITH_FALLBACK cmp=MY_PACKAGE_NAME/com.facebook.LoginActivity (has extras) } from pid 5077
I/Prime31 ( 5077): FacebookPlugin: openActiveSession.call with state: OPENING, exception: null
V/ActivityManager( 1444): Checking to restart com.facebook.LoginActivity: changed=0x0, handles=0x0
V/ActivityManager( 1444): oldConfig={ scale=1.0 imsi=250/2 loc=ru_RU touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=3 skin=default fontsize=3}
V/ActivityManager( 1444): newConfig={ scale=1.0 imsi=250/2 loc=ru_RU touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=3 skin=default fontsize=3}
V/WindowManager( 1444): Finished animation in AppWindowToken{40e61148 token=HistoryRecord{408389c8 MY_PACKAGE_NAME/com.prime31.UnityPlayerNativeActivity}} @ 6621760
I/ActivityManager( 1444): Displayed MY_PACKAGE_NAME/com.facebook.LoginActivity: +547ms
V/WindowManager( 1444): Finished animation in AppWindowToken{40c836a8 token=HistoryRecord{40d3d640 MY_PACKAGE_NAME/com.facebook.LoginActivity}} @ 6621760
D/NativeCrypto( 3576): returned from sslSelect() with result 1, error code 2
W/fb4a(:<default>):BlueServiceQueue( 3576): Exception during service
W/fb4a(:<default>):BlueServiceQueue( 3576): com.facebook.http.protocol.ApiException: Invalid application MY_VALID_APP_ID
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:81)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:110)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.http.protocol.ApiResponse.h(ApiResponse.java:291)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:272)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.katana.server.protocol.AuthorizeAppMethod.a(AuthorizeAppMethod.java:29)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:152)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.http.protocol.AbstractSingleMethodRunner.a(AbstractSingleMethodRunner.java:16)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.katana.server.handler.PlatformOperationHandler.c(PlatformOperationHandler.java:366)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.katana.server.handler.PlatformOperationHandler.a(PlatformOperationHandler.java:259)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:293)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:53)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.fbservice.service.BlueServiceQueue$3.run(BlueServiceQueue.java:230)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:444)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at com.facebook.common.executors.HandlerExecutorServiceImpl$ListenableScheduledFuture.run(HandlerExecutorServiceImpl.java:268)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at android.os.Handler.handleCallback(Handler.java:587)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at android.os.Handler.dispatchMessage(Handler.java:92)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at android.os.Looper.loop(Looper.java:150)
W/fb4a(:<default>):BlueServiceQueue( 3576):     at android.os.HandlerThread.run(HandlerThread.java:60)
W/Bundle  ( 5077): Key com.facebook.platform.protocol.PROTOCOL_VERSION expected String but value was a java.lang.Integer.  The default value <null> was returned.
W/Bundle  ( 5077): Attempt to cast generated internal exception:
W/Bundle  ( 5077): java.lang.ClassCastException: java.lang.Integer
W/Bundle  ( 5077):      at android.os.Bundle.getString(Bundle.java:1040)
W/Bundle  ( 5077):      at android.content.Intent.getStringExtra(Intent.java:3685)
W/Bundle  ( 5077):      at com.facebook.AuthorizationClient$KatanaLoginDialogAuthHandler.tryAuthorize(AuthorizationClient.java:821)
W/Bundle  ( 5077):      at com.facebook.AuthorizationClient.tryCurrentHandler(AuthorizationClient.java:272)
W/Bundle  ( 5077):      at com.facebook.AuthorizationClient.tryNextHandler(AuthorizationClient.java:238)
W/Bundle  ( 5077):      at com.facebook.AuthorizationClient$GetTokenAuthHandler.getTokenCompleted(AuthorizationClient.java:772)
W/Bundle  ( 5077):      at com.facebook.AuthorizationClient$GetTokenAuthHandler$1.completed(AuthorizationClient.java:731)
W/Bundle  ( 5077):      at com.facebook.internal.PlatformServiceClient.callback(PlatformServiceClient.java:144)
W/Bundle  ( 5077):      at com.facebook.internal.PlatformServiceClient.handleMessage(PlatformServiceClient.java:128)
W/Bundle  ( 5077):      at com.facebook.internal.PlatformServiceClient$1.handleMessage(PlatformServiceClient.java:54)
W/Bundle  ( 5077):      at android.os.Handler.dispatchMessage(Handler.java:99)
W/Bundle  ( 5077):      at android.os.Looper.loop(Looper.java:150)
W/Bundle  ( 5077):      at android.app.ActivityThread.main(ActivityThread.java:4385)
W/Bundle  ( 5077):      at java.lang.reflect.Method.invokeNative(Native Method)
W/Bundle  ( 5077):      at java.lang.reflect.Method.invoke(Method.java:507)
W/Bundle  ( 5077):      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
W/Bundle  ( 5077):      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
W/Bundle  ( 5077):      at dalvik.system.NativeStart.main(Native Method)

当我在Facebook本机应用程序中注销时,行为会略有变化-登录屏幕出现,但当显示主应用程序活动时,我会得到相同的 CLOSED_LOGIN_FAILED 会话状态。
我已经检查了 Facebook 应用程序设置中的应用程序 ID 和哈希密钥:两者都与我的应用程序设置相匹配。 Prime31 插件记录的哈希密钥与在 Windows 环境中创建的哈希密钥相同。 当我将应用程序 ID 更改为其他值时,会出现另一个错误-"无效的应用程序 ID"。 因此,应用程序 ID 似乎已正确设置。 我还可能错过了什么?
3个回答

11

对于遇到类似问题的所有人,请检查您的Facebook应用程序沙盒模式和启动应用程序时当前活跃的Facebook用户。在我的情况下,我正在启动处于沙盒模式下的应用程序,并且当前的Facebook用户不在Facebook应用程序设置中授予用户列表中。


0

如果有人需要帮助,我遇到了同样的问题,原因是我的测试手机将时间设置了3-4个月后。


0
这可能是因为 Facebook 应用程序使用了之前未在 Facebook 注册的 ID。请前往 https://developers.facebook.com,注册一个新应用程序,您将收到一个数字 ID(类似于 10 位数),您应该将其嵌入代码中。在 react-native-fbsdk 中,这称为 facebook_app_idfacebook_application_id

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接