# Putting a break on console warning

**URL:** <https://forums.swift.org/t/putting-a-break-on-console-warning/64092>\
**Category:** Using Swift\
**Tags:** urlsession\
**Created:** [March 30, 2023, 11:03pm UTC](https://forums.swift.org/t/putting-a-break-on-console-warning/64092 "2023-03-30T23:03:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [March 30, 2023, 11:03pm UTC](https://forums.swift.org/t/putting-a-break-on-console-warning/64092/1 "2023-03-30T23:03:01Z")

</div>

I am getting this console warning:

> [@](#):
>
> [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.

How do I put a breakpoint on it? It is not obvious what "this method" it's talking about.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [March 31, 2023, 12:45am UTC](https://forums.swift.org/t/putting-a-break-on-console-warning/64092/2 "2023-03-31T00:45:17Z")

</div>

You should see a runtime warning as well, which may be able to point to the source. Make sure you haven’t turned off the `os` module functionality. Most of the time this warning is from `WKWebView`, unless you’re using the Security APIs directly.

---

<div class="post-metadata">

**Author:** ![bbrk24](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/bbrk24/32/27370_2.png) [@bbrk24](https://forums.swift.org/u/bbrk24)\
**Post date:** [March 31, 2023, 1:58am UTC](https://forums.swift.org/t/putting-a-break-on-console-warning/64092/3 "2023-03-31T01:58:14Z")

</div>

If it is from `WebView` as @Jon_Shier said, ime there's no way around this: If it's on the main thread you get this warning, and if it's off the main thread it kills your app.

---

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [March 31, 2023, 9:20am UTC](https://forums.swift.org/t/putting-a-break-on-console-warning/64092/4 "2023-03-31T09:20:36Z")

</div>

Indeed. WebKit itself calls this on the main thread:

```swift
SecTrustCopyCertificateChain → SecTrustEvaluateIfNecessary

```

and that complains.

Wanted to check if this error is caused by my code or not - it is not in this case, so all good for now.

Apparently someone in Apple was also annoyed with this error to the extent they've put a workaround: this error is not logged if my app's bundle identifier is prefixed with `"com.apple."` 😉

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [March 31, 2023, 9:04pm UTC](https://forums.swift.org/t/putting-a-break-on-console-warning/64092/5 "2023-03-31T21:04:58Z")

</div>

> [@tera](#):
>
> Apparently someone in Apple was also annoyed with this error to the extent they've put a workaround: this error is not logged if my app's bundle identifier is prefixed with `"com.apple."` 😉

That's amazing. No wonder it's not fixed.

---

<div class="post-metadata">

**Author:** ![eskimo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/eskimo/32/13558_2.png) [@eskimo](https://forums.swift.org/u/eskimo)\
**Post date:** [April 1, 2023, 1:25am UTC](https://forums.swift.org/t/putting-a-break-on-console-warning/64092/6 "2023-04-01T01:25:19Z")

</div>

See [this DevForums post](https://developer.apple.com/forums/thread/714467?answerId=734799022#734799022) for my take on this general issue.

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

---

<div class="post-metadata">

**Author:** ![1-877-547-7272](https://avatars.discourse-cdn.com/v4/letter/1/278dde/32.png) [@1-877-547-7272](https://forums.swift.org/u/1-877-547-7272)\
**Post date:** [April 1, 2023, 7:03am UTC](https://forums.swift.org/t/putting-a-break-on-console-warning/64092/7 "2023-04-01T07:03:37Z")

</div>

It appears that a fix for this was merged into WebKit on January 5th.

> <https://github.com/WebKit/WebKit/pull/8161>
>
> \#### 6cd18ec581756428f9d624d38b1c48b1b0c591d0
> \<pre\>
> Move CertificateInfo::contai…nsNonRootSHA1SignedCertificate call from UI to web process
> \<a href="https://bugs.webkit.org/show\_bug.cgi?id=250043"\>https://bugs.webkit.org/show\_bug.cgi?id=250043\</a\>
> rdar://99324948
> 
> Reviewed by Chris Dumez.
> 
> It calls security framework functions which call SecTrustEvaluateIfNecessary which now warns developers
> when it&apos;s used on the main thread. This warning is a good thing, but many developers are getting
> confused and thinking that the problem is in their application code, when it&apos;s really in WebKit code.
> To stop the warning when debugging third party apps, move the call to the web process. Also stop
> sending an unnecessary std::optional.
> 
> \* Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp:
> (WebKit::ProvisionalFrameProxy::didCommitLoadForFrame):
> \* Source/WebKit/UIProcess/ProvisionalFrameProxy.h:
> \* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
> (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
> \* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
> \* Source/WebKit/UIProcess/WebFrameProxy.cpp:
> (WebKit::WebFrameProxy::commitProvisionalFrame):
> \* Source/WebKit/UIProcess/WebFrameProxy.h:
> \* Source/WebKit/UIProcess/WebPageProxy.cpp:
> (WebKit::WebPageProxy::commitProvisionalPage):
> (WebKit::WebPageProxy::didCommitLoadForFrame):
> \* Source/WebKit/UIProcess/WebPageProxy.h:
> \* Source/WebKit/UIProcess/WebPageProxy.messages.in:
> \* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
> (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
> 
> Canonical link: \<a href="https://commits.webkit.org/258511@main"\>https://commits.webkit.org/258511@main\</a\>
> \</pre\>
> 
> https://github.com/WebKit/WebKit/commit/ba0a1f6f35bdae80ecd9ee4245449e71cbf0fe17
> 
> | Misc | iOS, tvOS & watchOS | macOS | Linux | Windows |
> | ----- | ---------------------- | ------- | ----- | --------- |
> | \[✅ 🧪 style\](https://ews-build.webkit.org/#/builders/6/builds/101856 "Passed style check") | \[✅ 🛠 ios\](https://ews-build.webkit.org/#/builders/77/builds/11005 "Built successfully") | \[✅ 🛠 mac\](https://ews-build.webkit.org/#/builders/43/builds/34930 "Built successfully") | \[✅ 🛠 wpe\](https://ews-build.webkit.org/#/builders/8/builds/111191 "Built successfully") | 
> | | \[✅ 🛠 ios-sim\](https://ews-build.webkit.org/#/builders/76/builds/11966 "Built successfully") | \[✅ 🛠 mac-AS-debug\](https://ews-build.webkit.org/#/builders/85/builds/1919 "Built successfully") | \[✅ 🛠 gtk\](https://ews-build.webkit.org/#/builders/36/builds/94266 "Built successfully") | \[✅ 🛠 wincairo\](https://ews-build.webkit.org/#/builders/12/builds/108949 "Built successfully") 
> | \[✅ 🧪 webkitperl\](https://ews-build.webkit.org/#/builders/19/builds/107636 "Passed tests") | \[✅ 🧪 ios-wk2\](https://ews-build.webkit.org/#/builders/78/builds/9154 "Passed tests") | \[✅ 🧪 api-mac\](https://ews-build.webkit.org/#/builders/3/builds/92420 "Passed tests") | \[✅ 🧪 gtk-wk2\](https://ews-build.webkit.org/#/builders/35/builds/36936 "Passed tests") | 
> | | \[✅ 🧪 api-ios\](https://ews-build.webkit.org/#/builders/9/builds/91039 "Passed tests") | \[✅ 🧪 mac-wk1\](https://ews-build.webkit.org/#/builders/73/builds/23848 "Passed tests") | \[✅ 🧪 api-gtk\](https://ews-build.webkit.org/#/builders/34/builds/78721 "Passed tests") | 
> | | \[✅ 🛠 tv\](https://ews-build.webkit.org/#/builders/81/builds/4594 "Built successfully") | \[✅ 🧪 mac-wk2\](https://ews-build.webkit.org/#/builders/70/builds/25334 "Passed tests") | | 
> | | \[✅ 🛠 tv-sim\](https://ews-build.webkit.org/#/builders/82/builds/4677 "Built successfully") | \[✅ 🧪 mac-AS-debug-wk2\](https://ews-build.webkit.org/#/builders/84/builds/1774 "Passed tests") | | 
> | | \[✅ 🛠 watch\](https://ews-build.webkit.org/#/builders/80/builds/10759 "Built successfully") | \[✅ 🧪 mac-wk2-stress\](https://ews-build.webkit.org/#/builders/62/builds/44821 "Passed tests") | | 
> | | \[✅ 🛠 watch-sim\](https://ews-build.webkit.org/#/builders/79/builds/6429 "Built successfully") | | | 
> | \[✅ 🛠 🧪 unsafe-merge\](https://ews-build.webkit.org/#/builders/75/builds/3085 "Built successfully and passed tests") | | | |
