我正在努力使用Android facebook SDK 3.5 riigth ow。一切都与我的帐户完美配合。现在我将应用程序交给了我的一个朋友,当他登录时,由于这次失败,他确实没有登录:
ApiException:The proxied app cannot request publish permissions without having being installed previously
11-19 12:18:43.530: W/System.err(13495): com.facebook.FacebookAuthorizationException: UnknownError:
ApiException:The proxied app cannot request publish permissions without having being installed previously.
11-19 12:18:43.530: W/System.err(13495): at com.facebook.Session.handleAuthorizationResult(Session.java:1078)
11-19 12:18:43.530: W/System.err(13495): at com.facebook.Session.onActivityResult(Session.java:554)
11-19 12:18:43.530: W/System.err(13495): at com.lochmann.viergewinntmultiplayerfb.MainActivity.onActivityResult(MainActivity.java:289)
11-19 12:18:43.530: W/System.err(13495): at android.app.Activity.dispatchActivityResult(Activity.java:5390)
11-19 12:18:43.530: W/System.err(13495): at android.app.ActivityThread.deliverResults(ActivityThread.java:3178)
11-19 12:18:43.530: W/System.err(13495): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3225)
11-19 12:18:43.535: W/System.err(13495): at android.app.ActivityThread.access$1100(ActivityThread.java:140)
11-19 12:18:43.535: W/System.err(13495): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1275)
11-19 12:18:43.535: W/System.err(13495): at android.os.Handler.dispatchMessage(Handler.java:99)
11-19 12:18:43.535: W/System.err(13495): at android.os.Looper.loop(Looper.java:137)
11-19 12:18:43.535: W/System.err(13495): at android.app.ActivityThread.main(ActivityThread.java:4898)
11-19 12:18:43.535: W/System.err(13495): at java.lang.reflect.Method.invokeNative(Native Method)
11-19 12:18:43.535: W/System.err(13495): at java.lang.reflect.Method.invoke(Method.java:511)
11-19 12:18:43.535: W/System.err(13495): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
11-19 12:18:43.535: W/System.err(13495): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
11-19 12:18:43.540: W/System.err(13495): at dalvik.system.NativeStart.main(Native Method)
这是我的登录代码
public void login(final Activity activity, final IFBCallbacks callback) {
if (isLoggedin()) {
if (callback != null)
callback.onLoggedIn();
actionsAfterLoggedIn(activity, callback);
Log.i(TAG, "Already Logged in");
return;
}
if (!isLoggedin()) {
Log.i(TAG, "login() NOT LOGGED IN");
logout(activity, null);
}
Log.i(TAG, "NOT LOGGED IN");
_session = new Session.Builder(activity).build();
Session.setActiveSession(_session);
Session.OpenRequest request = new Session.OpenRequest(activity);
// Note that you cannot set email AND publish_actions in the same
// request
request.setPermissions(getNeededPermisiions());
// request.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
StatusCallback scallback = new StatusCallback() {
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (state.isOpened() && hasPermissions(getNeededPermisiions())) {
Log.i(TAG, "Succesfully logged in to facebook");
if (callback != null)
callback.onLoggedIn();
actionsAfterLoggedIn(activity, callback);
session.getAccessToken();
FBUtils.saveAccesToken(activity, session.getAccessToken(),
session.getExpirationDate());
return;
}
// Grant permissions
if (!session.getPermissions().containsAll(
getNeededPermisiions())
&& session.isOpened()) {
Log.i(TAG, "Not all needed Permissions granted");
// session.requestNewPublishPermissions(new
// Session.NewPermissionsRequest(
// activity, getNeededPermisiions()));
return;
}
// EVERYTHING ELSE
if (!state.isOpened() && exception != null) {
Log.e(TAG, "Unable to login in");
exception.printStackTrace();
if (callback != null)
callback.onError(exception);
}
}
};
_session.addCallback(scallback);
_session.openForPublish(request);
}
我想我需要安装请求,但我找不到任何解决方法如何修复它。有人能给我一些提示吗?
答案 0 :(得分:5)
您需要分离“读取”和“发布”权限,并且在您可以请求发布权限之前,您需要首先获得至少“basic_info”,这是一个读取权限。
如果您只是在没有任何读取权限的情况下进行openForPublish,那么您将收到此错误。