我正在使用社交框架附加文本和图像以在Facebook和Twitter上分享,但共享是在我的墙上完成的。我需要添加选项以在朋友的墙上发布。 我的代码如下
“AttachmentTableViewController.h”
#import <UIKit/UIKit.h>
@interface SocialSharingViewController : UIViewController
- (IBAction)postToTwitter:(id)sender;
- (IBAction)postToFacebook:(id)sender;
@end
“AttachmentTableViewController.m”
#import <Social/Social.h>
- (IBAction)postToTwitter:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
SLComposeViewController *tweetSheet = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText:@"Great fun to learn iOS programming at appcoda.com!"];
[self presentViewController:tweetSheet animated:YES completion:nil];
}
}
- (IBAction)postToFacebook:(id)sender {
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"First post from my iPhone app"];
[self presentViewController:controller animated:YES completion:Nil];
}
}
此代码发布在我的墙上,但我需要添加在朋友的墙上分享的可能性。请帮忙。
非常感谢!