0

我用它来上传带有消息的图像:

NSMutableDictionary *dic=[NSMutableDictionary dictionaryWithCapacity:2];
    [dic setObject:@"a message" forKey:@"message"];
    [dic setObject:UIImagePNGRepresentation([UIImage imageNamed:@"1.png"]) forKey:@"source"];

    [FBRequestConnection startWithGraphPath:@"me/photos" parameters:dic HTTPMethod:@"POST"
     completionHandler:^(FBRequestConnection *connection,id result,NSError *error) {
         NSString *alertText;
         if (error) {
             alertText = [NSString stringWithFormat:
                          @"error: domain = %@, code = %d",
                          error.domain, error.code];
             NSLog(@"%@",error);
         } else {
             alertText = [NSString stringWithFormat:
                          @"Posted action, id: %@",
                          [result objectForKey:@"id"]];
         }
         // Show the result in an alert
         [[[UIAlertView alloc] initWithTitle:@"Result"
                                     message:alertText
                                    delegate:self
                           cancelButtonTitle:@"OK!"
                           otherButtonTitles:nil]
          show];
     }];

它工作正常,我可以在我的相册中看到图像,但我的主页视图中没有显示上传状态。如何上传带有消息的图像,并且可以在我的主页视图中显示?

4

1 回答 1

0

您的代码完全没问题,我认为问题在于您必须将您的 FB 故事排序为Most recent from Top stories

在此处输入图像描述

于 2013-11-16T08:59:04.630 回答