2013-02-28 90 views
0

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

权限:

“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]; 



} 

我做错了什么?

回答

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

             andParams:params 

            andHttpMethod:@"POST" 

            andDelegate:self]; 

而不是“我/饲料”,你必须提供你想分享的墙上的朋友的Facebook ID。

+0

我需要分享我所有的朋友在同一时间 – San 2013-02-28 08:49:17