Reputation: 484
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. 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];
Upvotes: 6
Views: 4492
Reputation: 351
I believe the link is indeed not being shown. But, when you post it, the link will be added to your Facebook/twitter post.
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];
Upvotes: 6