我正在使用UIActivityViewController来实现分享按钮。当我从列表中选择邮件选项时,它会显示文本和URL,但是当我选择Facebook或Twitter时,它只显示文本而不显示URL。我搜索了很多但没有找到解决办法。我得到了另一个解决方案,即在URL中添加“http”,但是不添加“http”是否可能?我的代码如下 -
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];
str = [NSString stringWithFormat:@"sportssquares://square?%@",squareID]; noteStr = @"您已被邀请加入Square游戏,请在您的iPhone上点击下面的链接。"; NSURL *url = [NSURL URLWithString:str]; activityItems = @[noteStr,url];
但是它给我一个错误提示:"无法发布到Facebook - 连接到Facebook失败"。 - Chaaruu Jadhav