4

是否可以使用 Facebook SDK 或 Graph API 创建如下帖子?

在此处输入图像描述

我基本上想将这两者结合在一起:

[FBRequestConnection startForUploadPhoto:[UIImage imageNamed:@"myImage"] completionHandler:nil];
[FBRequestConnection startForPostStatusUpdate:@"Hello, World!" completionHandler:nil];

谢谢。

4

2 回答 2

1

使用以下方法:

// Present share dialog
[FBDialogs presentShareDialogWithLink:params.link
                                 name:params.name
                              caption:params.caption
                          description:params.description
                              picture:params.picture
                          clientState:nil
                              handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                if(error) {
                                  // An error occurred, we need to handle the error
                                  // See: https://developers.facebook.com/docs/ios/errors
                                  NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
                                } else {
                                  // Success
                                  NSLog(@"result %@", results);
                                }
                              }];

这是参考:https ://developers.facebook.com/docs/ios/share

于 2014-02-18T06:02:56.173 回答
0

尝试这个,

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

        NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
        [dictionary setObject:UIImagePNGRepresentation(_image) forKey:@"picture"];

        if (message) {
            [dictionary setObject:message forKey:@"message"];
        }
        FBRequest *request = [FBRequest requestWithGraphPath:@"me/photos" parameters:dictionary HTTPMethod:@"POST"];
        [connection addRequest:request completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

        }];

        [connection start];
于 2014-02-18T04:43:42.880 回答