SLComposeViewController setInitialText not showing up in View

风格不统一 提交于 2019-11-29 03:55:29

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.

This behaviour is intended. See also this bug report: https://developers.facebook.com/bugs/962985360399542/. As @WizKid mentions, it's against policy to pre-fill text. Up until recently, you could still do so (violating the policy) but now this is actually enforced.

There is nothing you can do for this on your side; it's a policy enforcement by Facebook.

Also, related Rdar: http://openradar.appspot.com/20709403

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!