"UI unresponsiveness" warning on @main

I'm seeing a runtime warning in Xcode 14 Beta 5 that says "This method should not be called on the main thread as it may lead to UI unresponsiveness."

This is happening on the @main entry point of my app. See below:

The warning shown gives me no insight into what's actually going wrong. I think it may be due to some Core Location code that runs when the app first opens, but is there a way for me to get some more insight into what's causing this?

Or is this possibly an Xcode 14/iOS 16 bug, and this is not an issue to worry about? I'm not getting any warnings on Xcode 13/iOS 15.

Answered by DTS Engineer in 730526022

The purple warning is calling attention to a runtime issue that may impact the performance of your app. In general, you should resolve these issues when they are in your code, by moving the code off the main thread. When you receive one of these runtime performance issues, you can expand the backtrace in the Issue Navigator, available through the View > Navigators > Issues menu, to see where the issue is located.

If you find the issue is pointing at an Apple framework, please use Feedback Assistant to open a bug report to let us know, and include the complete backtrace shown in the issue navigator. You can post the FB numbers to this thread for visibility. Further, if you can't identify where the issue is coming from, as the backtrace points to your main function, please also let us know, including the provided backtrace.

If you find the runtime issue is resulting from an Apple API call used in a sub-optimal way within a third-party library that your app uses, please open a bug report with the library vendor.

I also have this security warnings 40+ on Xcode 14.1: 0x0000000000000000 in SecTrustEvaluateIfNecessary ().

I have encountered this same error when loading a view controller with a WKWebView. I filed FB11771307.

Do we have solution or know what risks we run into when we need to show WKWebView on launch?

Same issue!

Same issue!

Same issue here. No problem with iOS 15, Xcode 13, but I get this warning with Xcode 14.1. I wonder if this is an issue with my app or a bug of Xcode 14.

same, but related to CoreLocation

# I have the same problem, I don't have a problem on ios 15 devices, but when opening webview on ios 16 devices, first a black screen comes for 1 second, then webview opens.

Any updates for this issues ? why we always have this warning with every wkwebview.load() call? is there any engineer from @Apple to explain the issues and how to avoid it ? what going wrong with wkwebview load method ?

An Apple engineer explained the issue in a separate thread here: https://developer.apple.com/forums/thread/714467?answerId=734799022#734799022

Short summary is that if the warning stack trace shows SecTrustEvaluateIfNecessary and SecTrustCopyCertificateChain followed by WebCore and WebKit code, then it's a known Apple issue. Using WKWebView causes Xcode to show this warning, and there's nothing devs can do to fix it. But it's just a noisy warning, not causing any real problem. Apple plans to fix the warning at some point but no ETA.

If you don't see the stack trace, you can expand the warning to view it by clicking the arrows ">" next to the purple warning icon in the left pane.

More details on the specific issue and on this Xcode diagnostic feature in general are in the thread linked above.

">

Same issue here, Xcode 14.1, When loading a request/URL in WKWebView

Hope it'll soon be fixed

I'm having the same issue when opening a WebView on our application.

Same issue, even without using webviews.

Same issue

"UI unresponsiveness" warning on @main
 
 
Q