2013-02-28 140 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

相關問題