FBConnect:“用户尚未授权应用程序执行此操作” [英] FBConnect: "The user hasn't authorized the application to perform this action"

查看:164
本文介绍了FBConnect:“用户尚未授权应用程序执行此操作”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个包含facebook墙贴的iPhone应用程序。登录后,我通过以下代码发布到用户的墙上:

I m developing an iPhone app which includes facebook wall posting.After log in, I post to user's wall by following code:

NSString *appIcon = [NSString stringWithString:@"http://a2.twimg.com/profile_images/416166235/apple-black_normal.png"];
NSString *appSiteUrl = [NSString stringWithString:@"http://www.apple.com"];
NSString *attachment= [NSString stringWithFormat:@"{\"caption\":\"%@ Likes in the iPhone App\",\"description\":\"\",\"media\":[{\"type\":\"image\",\"src\":\"%@\",\"href\":\"%@\"}]}",_facebookName,appIcon,appSiteUrl];

// [attachment stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSArray *obj = [NSArray arrayWithObjects:attachment,nil];
NSArray *keys = [NSArray arrayWithObjects:@"attachment",nil];
NSDictionary *params = [NSDictionary dictionaryWithObjects:obj forKeys:keys];

NSLog(@"atachment : %@",[params description]);

[[FBRequest requestWithDelegate:self] call:@"facebook.stream.publish" params:params];

这导致错误,说用户未授权应用程序执行此操作 。

This results into Error,saying that "The user hasn't authorized the application to perform this action".

在用户的Facebook个人资料中,该应用仅具有访问用户基本信息的权限。所以我需要从用户那里获取stream_publish。

In the Facebook Profile of user, the app has only permission to access user's basic information. So I need to take "stream_publish " from the user.

那么如何给予扩展权限Dialog(对于stream_publish的许可)??

So how to give extended permission Dialog (for permission of "stream_publish") ??

任何帮助将不胜感激。

Any help would be appreciated.

推荐答案

我已经找到了问题的解决方案。

I have Found the solution of the problem by myself.

实际上问题的原因是应用程序doest有权Post To Wall。
(publish_stream).Hence FB否认跟随错误。

Actually the cause of the problem is the application doest have permission to "Post To Wall". (publish_stream).Hence FB was denying with following error.

用户未授权此应用程序执行此操作。

"The user hasn't authorize this application to perform this action".

因此,当用户登录时,要求用户授予publish_stream的权限,

So when user logs in, Ask user to give permission of publish_stream,

- (void)session:(FBSession*)session didLogin:(FBUID)uid {

    FBPermissionDialog *permissions = [[FBPermissionDialog alloc]initWithSession:_session];
    permissions.permission = [NSString stringWithString: @"publish_stream"]; 
    [permissions show];

}

`

一旦用户允许Post to wall,这个对话框不会再出现了。

`
When once the user have allowed "Post to wall", this dialog wont appear ever again.

这篇关于FBConnect:“用户尚未授权应用程序执行此操作”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆