将消息发布到ios中的朋友墙

时间:2013-07-27 05:36:58

标签: ios facebook-ios-sdk

我使用此方法发布消息   NSLog(@“TOKEN:%@”,[[FBSession activeSession] accessTokenData]);

        NSMutableDictionary *birdict=[NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:Delegate.Namestring,delegate.idstring,delegate.dobstring,@"Happy Birthday", nil] forKeys:[NSArray arrayWithObjects:@"name",@"id",@"birthday",@"Description", nil]];


        FBRequest *request=[FBRequest requestWithGraphPath:[NSString stringWithFormat:@"%@/feed",delegate.idstring]parameters:birdict HTTPMethod:@"POST"];



        NSLog(@"%@",request);

        FBRequestConnection *connection=[[FBRequestConnection alloc]init];


        [connection addRequest:request completionHandler:^(FBRequestConnection *connection,id result,NSError *error)
         {
             if (error)
             {
                 //showing an alert for failure
                 UIAlertView *alertView = [[UIAlertView alloc]
                                           initWithTitle:@"Post Failed"
                                           message:error.localizedDescription
                                           delegate:nil
                                           cancelButtonTitle:@"OK"
                                           otherButtonTitles:nil];
                 [alertView show];
             }
         }];
        [connection start];
    }

但是,只发布了最后一位朋友的详细信息。我想发布完整的朋友列表。请给出解决方案。

1 个答案:

答案 0 :(得分:0)

NSArray *permissions =[NSArray arrayWithObjects:@"publish_actions",@"publish_stream",@"manage_friendlists", nil];

[[FBSession activeSession] reauthorizeWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceFriends
                                           completionHandler:^(FBSession *session, NSError *error) {
                                               /* handle success + failure in block */
                                           }];

来自:Referance