所以我想使用Xcode中的社交框架将我的webview的当前URL分享到facebook和twitter,有人能告诉我这里是怎么做的是我的代码
- (IBAction)social:(id)sender {
UIActionSheet *share = [[UIActionSheet alloc] initWithTitle:@"Pass on the news!" delegate:self cancelButtonTitle:@"OK" destructiveButtonTitle:nil otherButtonTitles:@"Post to Twitter", @"Post to Facebook", nil];
[share showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (actionSheet.tag == 0) {
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
SLComposeViewController *tweetSheet =[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText:@"Check out this article I found using the 'Pass' iPhone app: "];
[self presentViewController:tweetSheet animated:YES completion:nil];
} else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Sorry" message:@"You can't send a tweet right now, make sure you have at least one Twitter account setup and your device is using iOS6 or above!." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
}
}
答案 0 :(得分:0)
[tweetSheet addURL:self.webView.request.URL];