0

早上好,

我有此代码可以在我的画廊中发布照片:

- (IBAction)postPhotoClick:(UIButton *)sender {
    // Just use the icon image from the application itself.  A real app would have a more
    // useful way to get an image.
    UIImage *img = [UIImage imageNamed:@"Icon-72@2x.png"];

    // if it is available to us, we will post using the native dialog
    BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:self
                                                                    initialText:nil
                                                                          image:img
                                                                            url:nil
                                                                        handler:nil];
    if (!displayedNativeDialog) {
        [self performPublishAction:^{

            [FBRequestConnection startForUploadPhoto:img
                                   completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                                       [self showAlert:@"Photo Post" result:result error:error];
                                       self.buttonPostPhoto.enabled = YES;
                                   }];

            self.buttonPostPhoto.enabled = NO;
            //proceedToPost();
        }];
    }
}

但是,我需要将照片张贴在我朋友的画廊中。这是可能的?我怎么能这样做?

4

1 回答 1

0

通过使用图形 API,我找到了解决方案。

进行适当的登录后:

 NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   self.originalImage, @"source", 
                                   @"MessageText", @"message",
                                   nil];

 [self.facebook requestWithGraphPath:@"user_name/photos/"
                              andParams:params
                              andHttpMethod:@"POST"
                              andDelegate:self];

此代码用于在我的 albuns 中发布图像。现在我需要在我朋友的相册上发布一张照片。

于 2013-03-24T12:35:44.077 回答