Skip to content

Hell of ever calling again onWebContentProcessDidTerminate when beginning the app or reload PWA page on FOREGROUND at only real iPhone #2705

@SoliEstre

Description

@SoliEstre

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When the page loads (via app launch or refresh), onWebContentProcessDidTerminate is called, which triggers a callback to reload the page, leading to an infinite loop. With luck, the page will eventually load successfully. However, this probability decreases significantly with each update to the PWA page .What's more critical is that it occurs only in the foreground and only on a physical iPhone.

Expected Behavior

To be Loaded page finely as Android device or iPad device or running on iPhone by Apple simulator or same page on any browsers (with browser UI or installed standalone PWA).

Steps with code example to reproduce

late InAppWebViewSettings settings = InAppWebViewSettings(
isInspectable: kDebugMode,
applicationNameForUserAgent: "MangoClass/2.0.8",
javaScriptEnabled: true,
javaScriptCanOpenWindowsAutomatically: true,
supportMultipleWindows: true,
sharedCookiesEnabled: true,
thirdPartyCookiesEnabled: true,
mediaPlaybackRequiresUserGesture: false,
allowsInlineMediaPlayback: true,
textZoom: 100,
iframeAllow: "camera; microphone",
iframeAllowFullscreen: true,
disableDefaultErrorPage: true,
limitsNavigationsToAppBoundDomains: true,
cacheMode: CacheMode.LOAD_NO_CACHE,

  allowFileAccessFromFileURLs: true,
  allowUniversalAccessFromFileURLs: true,
  hardwareAcceleration: true,
  allowContentAccess: true,
  allowFileAccess: true,
  cacheEnabled: true,
  clearCache: false,

  domStorageEnabled: true,
  databaseEnabled: true,

  allowsLinkPreview: false,
  allowsBackForwardNavigationGestures: true,

);


                onWebContentProcessDidTerminate: (controller) async {
                  if (kDebugMode) print("Web content process did terminate");
                  pullToRefreshController?.endRefreshing();
                  setState(() {

                  });
                  if (_currentLifecycleState == AppLifecycleState.detached) {
                    SystemNavigator.pop();
                  } else if (_currentLifecycleState == AppLifecycleState.paused) {
                    SystemNavigator.pop();
                  } else if (_currentLifecycleState == AppLifecycleState.hidden) {
                    if ((DateTime.now().millisecondsSinceEpoch - _lastLifecycleChangeTime) > 5 * 60 * 1000) {
                      SystemNavigator.pop();
                    } else {
                      needReloadOnResume = true;
                    }
                  } else if (_currentLifecycleState == AppLifecycleState.inactive) {
                    if ((DateTime.now().millisecondsSinceEpoch - _lastLifecycleChangeTime) > 20 * 60 * 1000) {
                      SystemNavigator.pop();
                    } else {
                      needReloadOnResume = true;
                    }
                  } else if (isInit) {
                    while (!mounted) {
                      await Future.delayed(const Duration(milliseconds: 100));
                    }
                    await controller.reload();
                  } else {
                    await controller.reload();
                  }
                },

Stacktrace/Logs

[IOSInAppWebViewController] (iOS) WebView ID 0 calling "onWebContentProcessDidTerminate" using {}

Calling in load page(on running JS codes for initialize page or before then) when any timing.

Flutter version

v3.35.1

Operating System, Device-specific and/or Tool

iOS 16~26 (iPhone 12 Mini, iPhone 15 Pro)
but not happens on simulator

Plugin version

v6.2.0-beta.2

Additional information

Help me plz....

I don't understand why this only happens on a physical iPhone.

Here's the page that loads: https://class.mangoedu.co.kr

Self grab

  • I'm ready to work on this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions