你好我收到了facebook开发者的这个警告:
您的应用同时要求读取和写入权限。当用户尝试与Facebook共享内容时,您应该只询问写入权限。
我该怎么做才能解决这个问题?
谢谢。
答案 0 :(得分:0)
您需要包含Extended Permissions才能使用" publish_actions"。
This guide说明了如何设置权限并将帖子发布到墙上。实际上,如前所述的所需权限包括如下:
private static final List<String> PERMISSIONS = Arrays.asList("publish_actions");
要发布一个故事,他们甚至为您提供了必要的代码,这些代码也使用了&#34; publish_actions&#34;权限:
private void publishStory() {
Session session = Session.getActiveSession();
if (session != null){
// Check for publish permissions
List<String> permissions = session.getPermissions();
if (!isSubsetOf(PERMISSIONS, permissions)) {
pendingPublishReauthorization = true;
Session.NewPermissionsRequest newPermissionsRequest = new Session
.NewPermissionsRequest(this, PERMISSIONS);
session.requestNewPublishPermissions(newPermissionsRequest);
return;
} ... }
他们还使用以下代码检查权限:
private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
for (String string : subset) {
if (!superset.contains(string)) {
return false;
}
}
return true;
}
这意味着,您只需要使用写入权限,而不是读取权限。
希望这有帮助。
答案 1 :(得分:0)
In the rare case your app requires publishing permissions up front (for example, an app that does nothing but publish a user's mood to Facebook).
(1)first request the bare minimum read permissions at initial login. After the user logs in with Facebook,
(2)show the user a screen explaining why your app needs publishing permissions and let the user opt-in to the publishing permission request by clicking a button.
This will provide the user more context and improve your conversion.
Another legitimate case for requesting read and publish permissions back-to-back is for users that log in to your app with email or a non-Facebook login option.
When these users want to publish to Facebook, your app will need to request read permissions to connect their account followed by publishing permissions back-to-back.
In this case, make sure that the only read permissions you request are public profile and friend list.
This provides the best user experience because the user wants to simply publish from your app and is not interested in providing additional read permissions.
It will also improve your conversion.