0

我想将文本发布到朋友墙,但使用此代码存在一些问题...

-(IBAction)PostToBuddyWall
{    
    NSMutableDictionary  *postVariablesDictionary = [[NSMutableDictionary alloc] init];    

    [postVariablesDictionary setObject:@"LOL" forKey:@"name"];
    [postVariablesDictionary setObject:@"helllo" forKey:@"message"];

     Facebook *fb = [((AppDelegate*)[[UIApplication sharedApplication] delegate]) fbInstance];
    [fb requestWithGraphPath:[NSString stringWithFormat:@"%@/feed",self.fbFriendsInvited] andParams:postVariablesDictionary andHttpMethod:@"POST" andDelegate:nil];

    NSLog(@"message: %@",postVariablesDictionary);
    [postVariablesDictionary release];

    UIAlertView *facebookAlter=[[UIAlertView alloc] initWithTitle:@"Message" message:@"Posted successfully on facebook" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil, nil];
    [facebookAlter show];
    [facebookAlter release];

    [self dismissViewControllerAnimated:YES completion:nil];
}

如果你有请给建议...谢谢!

4

1 回答 1

0

尝试这个 :

 NSMutableDictionary  *postVariablesDictionary = [[NSMutableDictionary alloc] init];    

[postVariablesDictionary setObject:@"LOL" forKey:@"name"];
[postVariablesDictionary setObject:@"helllo" forKey:@"message"];

//Post to friend's wall.
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/feed", self.fbFriendsInvited] parameters: postVariablesDictionary HTTPMethod:@"POST" 
                          completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
         NSLog(@"%@",result);
}];
于 2013-06-21T05:36:32.093 回答