使用新的sdk在我的Facebook墙上发布

Gho*_*use 11 iphone facebook ios

我正在使用新的Facebook SDK按照他们的指示在我的墙上发布

我从应用程序获得授权,但当我尝试发布时,我收到错误 Error: HTTP status code: 400,我发布了我的代码

 - (void)viewDidLoad
{
self.postParams =
 [[NSMutableDictionary alloc] initWithObjectsAndKeys:
 @"https://developers.facebook.com/ios", @"link",
 @"https://developers.facebook.com/attachment/iossdk_logo.png", @"picture",
 @"Facebook SDK for iOS", @"name",
 @"build apps.", @"caption",
 @"testing for my app.", @"description",
 nil]; 

[self.postParams setObject:@"hgshsghhgsls" forKey:@"message"];

[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

-(IBAction)Post{
AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate openSessionWithAllowLoginUI:YES];


[FBRequestConnection   startWithGraphPath:@"me/Mac" parameters:self.postParams HTTPMethod:@"POST"
                        completionHandler:^(FBRequestConnection *connection,id result,NSError *error) {
                            NSString *alertText;
                             if (error) {
                             alertText = [NSString stringWithFormat:@"error: domain = %@, code = %d, des = %d",error.domain, error.code,error.description];
                             } 
                             else 
                             {
                             alertText = [NSString stringWithFormat:@"Posted action, id: %@",[result objectForKey:@"id"]];
                             }
                             // Show the result in an alert
                             [[[UIAlertView alloc] initWithTitle:@"Result" message:alertText delegate:self cancelButtonTitle:@"OK!"
                             otherButtonTitles:nil]show];
                        }]; 




}
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么,任何建议都会很棒,这个新的SDK是测试版?还是一个完整的?

小智 12

如果您遇到任何问题,请尝试在您有兴趣调试的请求调用之前添加此代码来启用日志记录:

[FBSettings setLoggingBehavior:[NSSet setWithObjects:FBLoggingBehaviorFBRequests, FBLoggingBehaviorFBURLConnections, nil]];


Gho*_*use 4

最后我解决了这个问题,因为我必须在我的应用程序权限页面中将身份验证令牌参数更改为 URLFragment 然后它才能工作

  • 是的,在developer.facebook.com上,我选择了我的应用程序,然后编辑设置,在下一页中,我选择了左侧的权限,在身份验证令牌参数选项中,我更改为URL片段选项。这就是我所做的一切,就是在职的 (5认同)