1

我在 Facebook 登录时遇到了一些困难,这在 1 周前运行良好。我正在使用 facebook sdk 3.0.1,这是我的代码

private void fbfunc() {

        login.setEnabled(false);
        Session.StatusCallback fbStatusCallback = new Session.StatusCallback() {
            @Override
            public void call(Session session, SessionState state,
                    Exception exception) { // callback for session state changes
                if (state.isOpened()) {

                    Request.executeMeRequestAsync(session,
                            new GraphUserCallback() {

                                @Override
                                public void onCompleted(GraphUser user,
                                        Response response) {

                                    login.setEnabled(true);
                                    JSONObject jsonObj = user
                                            .getInnerJSONObject();
                                    dat = jsonObj.toString();

                                    if(pdialog!=null)
                                        pdialog.dismiss();

                                    fblog fb = new fblog();
                                    fb.execute();

                                    System.out.println(">>>>>>>>>" + dat);
                                }
                            });
                }
            }
        };

        openActiveSession(this, true, fbStatusCallback,
                Arrays.asList("email", "user_birthday","user_hometown","user_location"));


    }


private static Session openActiveSession(Activity activity,
            boolean allowLoginUI, StatusCallback callback,
            List<String> permissions) {
        OpenRequest openRequest = new OpenRequest(activity)
                .setPermissions(permissions)
                .setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK)
                .setCallback(callback)
                .setDefaultAudience(SessionDefaultAudience.FRIENDS);
        Session session = new Session.Builder(activity).build();
        if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState())
                || allowLoginUI) {
            Session.setActiveSession(session);
            session.openForRead(openRequest);
            return session;
        }
        return null;
    }

现在它给了我例外

活动 com.facebook.LoginActivity 泄露了最初添加在这里的窗口 com.android.internal.policy.impl.PhoneWindow$DecorView@405657c0

这真的很奇怪,因为它工作得很好。

4

0 回答 0