无法使用iOS 7.1中的UIActivityViewController在Facebook和Twitter上共享URL

无法使用iOS 7.1中的UIActivityViewController在Facebook和Twitter上共享URL,第1张

概述我正在使用UIActivityViewController进行分享按钮.当我从列表中选择邮件选项时它显示文本和网址但是当我选择Facebook或Twitter时它只显示文本而不是网址.我搜索了很多但没有得到我的问题的解决方案.我得到了在url中添加“http”的另一个解决方案,但这可能不在url中添加http.我的代码是 – NSArray *activityItems;NSString *st 我正在使用UIActivityVIEwController进行分享按钮.当我从列表中选择邮件选项时它显示文本和网址但是当我选择Facebook或Twitter时它只显示文本而不是网址.我搜索了很多但没有得到我的问题的解决方案.我得到了在url中添加“http”的另一个解决方案,但这可能不在url中添加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];
解决方法 我相信这个链接确实没有显示出来.但是,当您发布它时,该链接将添加到您的Facebook / Twitter帖子中.

当然,您也可以添加文本链接.

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];
总结

以上是内存溢出为你收集整理的无法使用iOS 7.1中的UIActivityViewController在Facebook和Twitter上共享URL全部内容,希望文章能够帮你解决无法使用iOS 7.1中的UIActivityViewController在Facebook和Twitter上共享URL所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1107541.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存