Embedded tweets broke when switching from iOS UIWebView to WKWebview




we have an iOS app that displays HTML content created by the app code. The HTML page created also contains embedded tweets. We recently switched from UIWebView to WKWebView, and tweet embeds stopped rendering properly. What should we do to fix the problem?


Hi @pth_alma!

Can you share a little more about your setup? Is there a url of the page you can share or the exact embed code you’re using?



Hi, here is a recent example of embed code, not working:

<blockquote class=\"twitter-tweet\" data-lang=\"fi\"><p lang=\"en\" dir=\"ltr\">We’re proud to be the only Western Conference team to finish without a losing record at Joe Louis Arena. <a href=\"https://twitter.com/hashtag/Farewell2TheJoe?src=hash\">#Farewell2TheJoe</a></p>— Vegas Golden Knights (@GoldenKnights) <a href=\"https://twitter.com/GoldenKnights/status/851181761023193088\">9. huhtikuuta 2017</a></blockquote><script async src=\"//platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>

Ignore the forward slashes, this is from source data that comes via JSON string property, hence the escaping of quotes.


Try adding https:// to the widgets.js URL so it looks like this: https://platform.twitter.com/widgets.js. Sometimes mobile apps have trouble handling protocol relative URLs.

Please let me know if that works or if you’re still having trouble!


Unfortunately, that did not help. It does not matter if widgets.js is from http or https, the tweets do not render.

So, still having trouble.


Is there anything else we could do to debug this issue?


Hi @pth_alma!

Unfortunately it’s hard to help debug since I can’t actually see what’s happening. Is the page producing any JS errors?

You can also take a look through our documentation to make sure your implementation is correct: https://dev.twitter.com/web/embedded-tweets


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.