将图片发布到Facebook好友的墙上

时间:2013-08-01 05:35:29

标签: iphone facebook uiimageview uiactivityviewcontroller

我使用UIActivityViewController将共享图片用于社交网络。我需要将我的图像发布到朋友的墙上。是否可以使用UIActivityViewController将图像发布到朋友的墙上。

1 个答案:

答案 0 :(得分:0)

使用NSData,您可以将图片添加到UIActivityViewController。尝试下面的一个。

NSString *text = @"your text goes here";

NSData *Da = UIImageJPEGRepresentation([UIImage imageNamed:@"Icon.png"], 1.0);

NSArray * activityItems = @[text,Da];

UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:[NSArray arrayWithObjects:nil]];
activityVC.excludedActivityTypes = @[UIActivityTypePostToWeibo]; //or whichever you don't need 
[activityVC setCompletionHandler:^(NSString *activityType, BOOL completed) {

}];
[self presentViewController:activityVC animated:YES completion:nil];