Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS macOS - This method should not be called on the main thread as it may lead to UI unresponsiveness #1678

Closed
nayanAubie opened this issue May 31, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@nayanAubie
Copy link

Environment

Technology Version
Flutter version 3.10.2
Plugin version 5.7.2+3
iOS version 16.5
macOS version 13.4
Xcode version 14.3

Device information: iPhone 11

Description

Error in the iOS platform when the device opens a web view "This method should not be called on the main thread as it may lead to UI unresponsiveness."

Code

InAppWebView(
   initialUrlRequest: URLRequest(url: _webViewUri),
   initialOptions: InAppWebViewGroupOptions(
   crossPlatform: InAppWebViewOptions(
   transparentBackground: true,
   ),
   ios: IOSInAppWebViewOptions(
   allowsBackForwardNavigationGestures: false,
   ),
  ),
)

simply add above code in body of Scaffold.

Images

Screenshot 2023-05-31 at 11 00 05 AM

Stacktrace

The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2023-05-31 16:42:14.217971+0530 Runner[13155:1108980] [Security] delegate_identifier:Performance Diagnostics__:::__message:This method should not be called on the main thread as it may lead to UI unresponsiveness.

@nayanAubie nayanAubie added the bug Something isn't working label May 31, 2023
@github-actions
Copy link

👋 @nayanAubie

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@Hilbert2048
Copy link

I got  so many warning message in Xcode when using InAppWebView:

This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.
This method should not be called on the main thread as it may lead to UI unresponsiveness.

@fabiansvensson
Copy link

Why are there non comments on this bug yet?

@puahhhh
Copy link

puahhhh commented Nov 9, 2023

Anyone has any solution to this yet ?

@pichillilorenzo pichillilorenzo changed the title This method should not be called on the main thread as it may lead to UI unresponsiveness iOS macOS - This method should not be called on the main thread as it may lead to UI unresponsiveness Nov 11, 2023
ps9310 pushed a commit to mayank4741/flutter_inappwebview that referenced this issue Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants