简体   繁体   English

无法在iOS中使用Facebook SDK发布到朋友墙

[英]Not able to post to friends wall with facebook sdk in ios

I have tried with openGraph and normal dialog as below, 我已经尝试过使用openGraph和下面的普通对话框,

[facebook requestWithGraphPath:[NSString stringWithFormat:@"/%@/feed",@"friends_fb_id" ] andParams:variables andHttpMethod:@"POST" andDelegate:self];

and

[facebook dialog:@"feed" andParams:params andDelegate:self]

I gave params for both methods as 我给两种方法的参数

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"friends_fb_id", @"to", @"I'm using the Hackbook for iOS app", @"name", @"Hackbook for iOS.", @"caption", @"Check out Hackbook for iOS to learn how you can make your iOS apps social using Facebook Platform.", @"description", @"http://m.facebook.com/apps/hackbookios/", @"link", @"http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png", @"picture", nil];

in delegate method it correctly return the Post_id, so its completing successfully but I can not see the post on friends wall. 在委托方法中,它正确返回了Post_id,因此它成功完成了,但是在朋友墙上看不到该帖子。 If try using the Hackbook app that comes with SDK it works perfectly. 如果尝试使用SDK随附的Hackbook应用程序,则可以完美运行。

What could be the possible solution. 有什么可能的解决方案。

Did you forget to enable publish_actions or publish_stream permissions during login? 您是否忘记了在登录期间启用publish_actionspublish_stream权限?

// login to FB
-(void) FBLogin
{
    NSArray *permissions = [[NSArray alloc] initWithObjects:@"publish_actions",@"publish_stream", nil];
    [FBSession openActiveSessionWithPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *_session, FBSessionState _status, NSError *_error) {
        //  do some login handling code here
    }];
}

You are using the string "friends_fb_id" should this not be an actual id? 您正在使用字符串“ friends_fb_id”,这不是实际的ID吗?

I had a similar situation where is was receiving the correct response, so it was posting, it was just posting to the wrong place. 我也遇到类似的情况,正在收到正确的响应,因此它是发布,只是发布到了错误的位置。 Make sure the id's are correct. 确保ID正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM