java Facebook、setReadPermissions 和 setPublishPermissions
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15727842/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Facebook, setReadPermissions and setPublishPermissions
提问by Aviram Fireberger
Hey I'm trying to use two different type of permissions.
嘿,我正在尝试使用两种不同类型的权限。
When I'm using only one, all works fine.
当我只使用一个时,一切正常。
But when I'm using both of them the app crashes:
但是当我同时使用它们时,应用程序崩溃了:
LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
authButton.setReadPermissions(Arrays.asList("friends_games_activity"));
authButton.setPublishPermissions(Arrays.asList("publish_actions"));
How can I add the 2 permissions (friends_games_activity
and publish_actions
) without problems?
如何毫无问题地添加 2 个权限(friends_games_activity
和publish_actions
)?
回答by M G
You cannot have both permissions in SDK 3.0, you need separate them. You can first open session for read, get what you want and then openForPublish.
在 SDK 3.0 中您不能同时拥有这两个权限,您需要将它们分开。您可以先打开 session 进行阅读,获取您想要的内容,然后 openForPublish。
Note: In the new SDK, you may ask only for read permissions when you first open a session. You should not prompt your user for publish permissions until the time at which they are actually publishing an action to Facebook. This increases user trust, and also the likelihood that your user will choose to publish stories from your app. To request further permissions, use Session.openForRead or Session.openForPublish.
注意:在新的 SDK 中,您可以仅在首次打开会话时请求读取权限。在用户实际向 Facebook 发布操作之前,您不应提示用户授予发布权限。这增加了用户的信任度,也增加了您的用户选择从您的应用发布故事的可能性。要请求更多权限,请使用 Session.openForRead 或 Session.openForPublish。
You need to call clearPermissions. It's described here http://developers.facebook.com/docs/reference/android/3.0/LoginButton/#setReadPermissions(List)
您需要调用 clearPermissions。它在这里描述 http://developers.facebook.com/docs/reference/android/3.0/LoginButton/#setReadPermissions(List)