Facebook的分享只发布在我的墙上而不是我朋友的墙上 - ios

时间:2013-02-28 08:05:22

标签: iphone ios objective-c facebook

我打算在Facebook上发布(图片或字符串或链接)。当我尝试使用以下代码发布时,它只发布在我的墙上,而不是显示在我的朋友墙上。

许可:

“read_stream”, “publish_stream”, “电子邮件”, “user_birthday”, “friends_about_me”, “friends_activities”, “friends_likes”。

 - (IBAction)fblogin:(id)sender {

     AppDelegate *getdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];

     getdelegate.facebook.sessionDelegate=self;

     Reachability *reachability = [Reachability reachabilityForInternetConnection];

     NetworkStatus internetStatus = [reachability currentReachabilityStatus];



     if (internetStatus != NotReachable) {

        if([getdelegate.facebook isSessionValid])

        {

            NSLog(@"User already logined with facebook");

        }

        else

        {

            [getdelegate.facebook authorize:[NSArray arrayWithObjects:@"read_stream",@"publish_stream",@"email",@"user_birthday",@"friends_about_me",@"friends_activities",@"friends_likes",nil]];

        }

    }

    else

    {

        NSLog(@"No Internet Connection");

    }

    }



    - (void)fbDidLogin

    {

    AppDelegate *getdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];

    [getdelegate.facebook requestWithGraphPath:@"me" andDelegate:self];

}



- (void) request:(FBRequest*)request didLoad:(id)result

{

    AppDelegate *getdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];

    if ([result isKindOfClass:[NSDictionary class]])

    {


    }
}



- (IBAction)Sharebutton:(id)sender

{

    AppDelegate *getdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];

    NSLog(@"TOKEN:%@",getdelegate.facebook.accessToken);



    NSURL *url = [NSURL URLWithString:@"http://www.facebook.com/images/devsite/iphone_connect_btn.jpg"];

    NSData *data = [NSData dataWithContentsOfURL:url];

    UIImage *img= [[UIImage alloc] initWithData:data];

    NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:img,@"picture",@"http://www.google.com",@"link",@"Message text",@"message",nil];

    [[getdelegate facebook] requestWithGraphPath:@"me/feed"

                                       andParams:params

                                   andHttpMethod:@"POST"

                                     andDelegate:self];



} 

我做错了什么?

2 个答案:

答案 0 :(得分:1)

阅读Facebook方法中更改此链接

https://developers.facebook.com/roadmap/completed-changes/

IdOfFriend / Feed方法不再适用

阅读它以获得更多帮助:

https://developers.facebook.com/docs/howtos/ios-6/

答案 1 :(得分:0)

[[getdelegate facebook] requestWithGraphPath:@"me/feed"

                                       andParams:params

                                   andHttpMethod:@"POST"

                                     andDelegate:self];

而不是“我/饲料”,你必须提供你想要分享的朋友的脸书ID。