如何创建一些相册Facebook SDK iOS?

时间:2013-02-25 04:17:29

标签: ios facebook facebook-graph-api

我向Facebook发布了一些照片,例如:

for (int idx = 0 ; idx < 5; idx++){
[FBRequestConnection startWithGraphPath: @"me/photos"
parameters: params
HTTPMethod: @"POST"
completionHandler: ^(FBRequestConnection *connection,
id result,
NSError *error) {
[self requestCompleted:connection withResult:result andError:error];
}];
}

这张照片发布在Facebook的默认相册中(appName照片)。如何在当前迭代中创建新相册?

1 个答案:

答案 0 :(得分:1)

我解决了我的问题,我需要这个字符串:

NSMutableDictionary *paramsToCreateAlbum = [NSMutableDictionary dictionaryWithObjectsAndKeys:
        @"album ", @"name",
        @"description", @"message", nil];

[FBRequestConnection startWithGraphPath: @"me/albums"
                             parameters: paramsToCreateAlbum
                             HTTPMethod: @"POST"
                      completionHandler: ^(FBRequestConnection *connection,
                              id result,
                              NSError *error) {

                          if (!error) {
                              //publish content to albumID
                              [self publishContentToAlbum:[result objectForKey:@"id"]];
                          }
                          else {
                              NSLog(@"error: %@", error);
                          }
                      }];