0

AI 正在使用以下代码在 facebook 上的用户墙上发布图像

NSData *imageData =UIImagePNGRepresentation(newPageView.image);
     UIImage *picture = [UIImage imageWithData:imageData];
    NSLog(@"picture is %@",picture);
    NSMutableDictionary   *variables = [NSMutableDictionary dictionaryWithCapacity:2];

        FbGraphFile *graph_file = [[FbGraphFile alloc] initWithImage:picture];

    [variables setObject:graph_file forKey:@"file"];

    [variables setObject:@"this is a test message: postPictureButtonPressed" forKey:@"message"];


    FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"/me/photos" withPostVars:variables];

以上代码在相册中发布图像。如何将其更改为在墙上发布图像?

4

1 回答 1

1

试试这个代码

  NSURL *url = [NSURL URLWithString:@"YOur Image url"];
    NSData *data = [NSData dataWithContentsOfURL:url];
    UIImage *img  = [[UIImage alloc] initWithData:data];

   [variables setObject:img forKey:@"picture"];


   FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"/me/photos" withPostVars:variables];
于 2012-04-27T10:28:19.343 回答