[英]Not able to share URL on Facebook and Twitter using UIActivityViewController in iOS 7.1
I am using UIActivityViewController for share button.It's showing text and url when I am selecting mail option from list but it's showing only text not url when I am selecting Facebook or Twitter.I searched a lot but not getting solution for my issue.I got one more solution to add "http" in url but is this possible without adding http in url. 我正在使用UIActivityViewController进行分享按钮。当我从列表中选择邮件选项时它显示文本和网址但是当我选择Facebook或Twitter时它只显示文本而不是网址。我搜索了很多但没有得到我的问题的解决方案。我得到了在url中添加“http”的另一个解决方案,但这可能不在url中添加http。 My code is - 我的代码是 -
NSArray *activityItems;
NSString *str;
NSString *noteStr;
str = [NSString stringWithFormat:@"com.boxscoregames.squares://square?%@",squareID];
noteStr = @"You have been invited to join the Square game, please follow the link below on your iPhone.";
NSURL *url = [NSURL URLWithString:str];
// str =[NSString stringWithFormat:@"<html><a href=\"%@\">%@</a></html>" ,str,str];
activityItems = @[noteStr,url];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];
I believe the link is indeed not being shown. 我相信这个链接确实没有显示出来。 But, when you post it, the link will be added to your Facebook/twitter post. 但是,当您发布它时,该链接将添加到您的Facebook / Twitter帖子中。
You could of course just also add the link to the text. 当然,您也可以添加文本链接。
NSString *link = [NSString stringWithFormat:@"com.boxscoregames.squares://square?%@",squareID];
NSString *noteStr = [NSString stringWithFormat:@"You have been invited to join the Square game, please follow the link below on your iPhone. %@", link];
NSURL *url = [NSURL URLWithString:link];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[noteStr, url] applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.