SLComposeViewController setInitialText不会在View中显示 [英] SLComposeViewController setInitialText not showing up in View

查看:113
本文介绍了SLComposeViewController setInitialText不会在View中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  SLComposeViewController * controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; 
[controller setInitialText:@这是我答应的链接:];
[controller addURL:[NSURL URLWithString:@http://www.url.com]];
[self presentViewController:controller animated:YES completion:nil];

当控制器呈现时,输入框中没有文本。您可以添加文本并发送正确(URL中也显示在Post中)。



我刚刚安装了FacebookSDK 4.01,它是一个iOS 7/8应用程序。



任何关于为什么初始文本不显示的想法。我甚至试图在没有URL的情况下做,但只做文字,但没有。



附加注意:如果我删除了addURL,那么当我触摸发布时,应用程序会冻结,并且该邮件永远不会发送。



感谢任何帮助!!!

解决方案

我发现一个很好的方法来解决这个问题,这仍然给用户带来了控制。



呈现SLComposerViewController我显示一个自我解雇警报(如果没有点击OK,则6秒解雇)。这个警报将包含写给你的朋友关于你玩的方式!\\\
\\\
你可以只是PASTE一个预设的信息。。



显示后警告,然后使用以下内容向UIPasteboard发送预设消息:

  UIPasteboard * pasteboard = [UIPasteboard generalPasteboard]; 
pasteboard.string = msg;

那么SLComposeViewController就会被显示出来,并提供一个警报视图。一旦用户关闭警报视图(或6秒钟通过,并且自动关闭),用户可以选择只是在消息文本中进行PASTE,您的预设消息。或者不是,这是它的美丽。



希望这有助于其他人绕开FB决定突然执行。我没有意识到使用setInitialText方法的FB是不符合政策的。



干杯。


I'm trying to use the SLComposeViewController to share a link in my iOS App.

SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"Here's the link I promised:"];
[controller addURL:[NSURL URLWithString:@"http://www.url.com"]];
[self presentViewController:controller animated:YES completion:nil];

When the controller presents, there is no text in the entry box. You can add text and send it fine (the URL shows up correctly in the Post as well).

I just installed FacebookSDK 4.01 and it's a iOS 7/8 App.

Any ideas on why the initial text isn't showing up. I even tried to do it without the URL and just do text, but nothing.

Additional Note: If I do remove the addURL, then the App freezes when I touch "Post" and the post never gets sent.

Thanks for any help!!!

解决方案

I found a nice way to work around this which still gives the user control.

For Facebook only, just before presenting the SLComposerViewController I show a self dismissing alert (with a 6 second dismissal if OK wasn't tapped). This alert will contain "Write to your friends about how you did playing !\n\nYou can just PASTE for a preset message.".

Right after showing the alert, I then use the following to post a preset message to the UIPasteboard:

    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    pasteboard.string = msg;

So then the SLComposeViewController is presented and an alert view right over it. Once the user dismisses the alert view (or 6 seconds passes and it self dismisses), that the user has the option to just PASTE, right in the message text, your preset message. Or not, that's the beauty of it.

Hope this helps some others get around what FB decided to suddenly enforce. I didn't even realize it was against policy to use the setInitialText method for FB.

Cheers.

这篇关于SLComposeViewController setInitialText不会在View中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆