-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed as not planned
Labels
found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12p: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specifically
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
This package work perfectly fine on android but for ios I am getting crash when I runJavaScript from webview. This happens only on iOS Side. For android I am able to send and receive data between js and flutter.
I am using latest version of package.
And the error at ios side is -
Unhandled Exception: PlatformException(FWFEvaluateJavaScriptError, Failed evaluating JavaScript., Instance of 'NSError', null)
#0 WKWebViewHostApiImpl.evaluateJavaScriptForInstances (package:webview_flutter_wkwebview/src/web_kit/web_kit_api_impls.dart:1050:7)
<asynchronous suspension>
#1 WebKitWebViewController.runJavaScript (package:webview_flutter_wkwebview/src/webkit_webview_controller.dart:385:7)
<asynchronous suspension>
#2 _WebViewExampleState.build.<anonymous closure> (package:my_rich_editor/web_view.dart:252:11)
<asynchronous suspension>Expected results
Expected result I should runJavaScript from ios side too.
Actual results
Actually it is not sending data from js to flutter
Code sample
Code sample
WebViewController controller = WebViewController();
controller
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..addJavaScriptChannel(
'GetAppCurrentLanguage',
onMessageReceived: (JavaScriptMessage message) {
print('GetAppCurrentLanguage');
String languageCode = "en";
},
)
..loadFlutterAsset('assets/demo.html');Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
Unhandled Exception: PlatformException(FWFEvaluateJavaScriptError, Failed evaluating JavaScript., Instance of 'NSError', null)
#0 WKWebViewHostApiImpl.evaluateJavaScriptForInstances (package:webview_flutter_wkwebview/src/web_kit/web_kit_api_impls.dart:1050:7)
<asynchronous suspension>
#1 WebKitWebViewController.runJavaScript (package:webview_flutter_wkwebview/src/webkit_webview_controller.dart:385:7)
<asynchronous suspension>
#2 _WebViewExampleState.build.<anonymous closure> (package:my_rich_editor/web_view.dart:252:11)
<asynchronous suspension>
Flutter Doctor output
Doctor output
Flutter (Channel stable, 3.10.3, on macOS 13.0.1 22A400 darwin-arm64, locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.78.2)
[✓] Connected device (3 available)
[✓] Network resourcescosminbodnariuc and amitsingh6391
Metadata
Metadata
Assignees
Labels
found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12p: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specifically