Swift - UIWebView - This application is modifying the autolayout engine
<p>I am trying to embed a youtube video in a <code>UIWebView</code> the code I have works fine however, every time I play the video and the video players opens I get a warning: </p>

<blockquote>
  <p>This application is modifying the autolayout engine from a background
  thread, which can lead to engine corruption and weird crashes.  This
  will cause an exception in a future release.<br>
  Stack:(     0<br>
  CoreFoundation                      0x0000000181e96dc8  +
  148   1   libobjc.A.dylib                     0x00000001814fbf80
  objc_exception_throw + 56     2   CoreFoundation<br>
  0x0000000181e96cf8  + 0     3   Foundation<br>
  0x0000000182947b2c  + 88    4   Foundation<br>
  0x00000001827c8c3c  + 36    5   UIKit<br>
  0x00000001870fcd98  + 64    6   UIKit<br>
  0x00000001870fd8b0  + 244   7   UIKit<br>
  0x000000018788b7f0  + 268   8   UIKit<br>
  0x0000000187308aa0  + 176   9   UIKit<br>
  0x0000000186ff01e4  + 656   10  QuartzCore<br>
  0x0000000184982994  + 148   11  QuartzCore<br>
  0x000000018497d5d0  + 292   12  QuartzCore<br>
  0x000000018497d490  + 32    13  QuartzCore<br>
  0x000000018497cac0  + 252   14  QuartzCore<br>
  0x000000018497c820  + 500   15  WebCore<br>
  0x0000000186b56270  + 176   16  WebCore<br>
  0x0000000186b18fa4  + 368   17  CoreFoundation<br>
  0x0000000181e4d09c  + 24    18  CoreFoundation<br>
  0x0000000181e4cb30  + 540   19  CoreFoundation<br>
  0x0000000181e4a830  + 724   20  CoreFoundation<br>
  0x0000000181d74c50 CFRunLoopRunSpecific + 384     21  WebCore<br>
  0x0000000185d6261c  + 456   22  libsystem_pthread.dylib<br>
  0x0000000181afbb28  + 156   23  libsystem_pthread.dylib<br>
  0x0000000181afba8c  + 0     24  libsystem_pthread.dylib<br>
  0x0000000181af9028 thread_start + 4 )</p>
</blockquote>

<p>The Code I use is:</p>

<pre><code>    let string = "&lt;html style='margin:0;background:black;'&gt;&lt;body style='margin:0;background:black;'&gt;&lt;iframe style='position:absolue;top:0;left:0;margin:0;' width='\(webViewWidth)' height='\(webViewHeight)' src='\(src)' frameborder='0' allowfullscreen&gt;&lt;/iframe&gt;&lt;/body&gt;&lt;/html&gt;"
   webViewYT.loadHTMLString(string as String, baseURL: nil)
</code></pre>

<p>Looking online I found out that I have to encapsulate UI changes in a dispatch_async.</p>

<p>How can I resolve this issue?</p>