以使用UIActivityViewController在Face

以使用UIActivityViewController在Face

本文介绍了我可以使用UIActivityViewController在Facebook上分享吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试使用UIActivityViewController在Facebook上分享。
当我使用

I am trying to use UIActivityViewController to share on facebook.When I am using the

UIImage* image = [UIImage imageNamed:@"image1.png"];
NSArray* dataToShare = @[@"test",image];
UIActivityViewController* activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:dataToShare
                                  applicationActivities:nil];
activityViewController.excludedActivityTypes = @[UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll];

虽然我没有排除UIActivityTypePostToFacebook,但我看不到分享到Facebook图标, 。是不是有预定的UIActivity的Facebook?

I can't see the "Share on Facebook" icon although I didn't exclude "UIActivityTypePostToFacebook". isn't there a predefined UIActivity for facebook ?

谢谢

推荐答案

尝试这样:如果你只想要Facebook图标分享:

Try this: if you want only facebook icon to share:

-(IBAction)shareButtonPressed:(id)sender { NSLog(@"shareButton pressed");

NSString *texttoshare = _txt;
UIImage *imagetoshare = _img;
NSArray *activityItems = @[texttoshare, imagetoshare];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo];
[self presentViewController:activityVC animated:TRUE completion:nil];
}

//在排除的活动类型的列表中插入任何其他类型的活动类型想排除

//in the list of excluded activity type insert any other kind of activitytypes you want to exclude

这篇关于我可以使用UIActivityViewController在Facebook上分享吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 14:05