SvenTiigi/YouTubePlayerKit

This method should not be called on the main thread

frlefebvre opened this issue · 1 comments

What happened?

In SwiftUI, any time I display a YouTubePlayerView, Xcode reports a "This method should not be called on the main thread as it may lead to UI unresponsiveness." security alert. Xcode does not point at the particular method and only at @main and it doesn't seem to result in any apparent issue as far as I can tell. But thought it might be something you'd want to fix.

What are the steps to reproduce?

Navigate to a view where a YouTubePlayerView is displayed. No need to press play or anything.

What is the expected behavior?

Xcode should not raise the following security alert: "This method should not be called on the main thread as it may lead to UI unresponsiveness."

Hi @frlefebvre,

Thanks for opening up an issue.
The issue you described is a main thread checker warning caused by the underlying WKWebView

The poor interaction between WKWebView, Security framework, and this Xcode feature is a known issue (r. 94019453). We plan to address it at some point but I don’t have any info to share as to when that’ll happen.

Bildschirm­foto 2023-01-29 um 17 23 51