-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to reproduce
All of sudden we are seeing this crash related to webview_flutter_wkwebview on our app when compiling in release mode (in debug mode everything works fine)
We haven't touched anything related to how we use webview_flutter or webview_flutter_wkwebview, this just started to happen.
We either didn't upgrade nor downgrade our flutter version.
We didn't run pub upgrade either and we have been using the following versions since long ago:
webview_flutter: ^4.10.0
webview_flutter_android: ^4.2.0
webview_flutter_wkwebview: ^3.16.3
This crash just started out of the blue:
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001e1c5d1d4 __pthread_kill + 8 (:-1)
1 libsystem_pthread.dylib 0x0000000219dc6ef8 pthread_kill + 268 (pthread.c:1721)
2 libsystem_c.dylib 0x000000019964fad8 abort + 128 (abort.c:122)
3 libswiftCore.dylib 0x00000001902351a4 swift::fatalErrorv(unsigned int, char const*, char*) + 136 (Errors.cpp:398)
4 libswiftCore.dylib 0x00000001902351c4 swift::fatalError(unsigned int, char const*, ...) + 32 (Errors.cpp:406)
5 libswiftCore.dylib 0x0000000190228b44 swift::swift_dynamicCastFailure(void const*, char const*, void const*, char const*, char const*) + 80 (Casting.cpp:411)
6 libswiftCore.dylib 0x0000000190228bc0 swift::swift_dynamicCastFailure(swift::TargetMetadata<swift::InProcess> const*, swift::TargetMetadata<swift::InProcess> const*, char const*) + 124 (Casting.cpp:425)
7 libswiftCore.dylib 0x000000019022df68 swift_dynamicCast + 344 (CompatibilityOverrideRuntime.def:109)
8 webview_flutter_wkwebview 0x0000000104a4a38c closure #1 in PigeonApiWKNavigationDelegate.didReceiveAuthenticationChallenge(pigeonInstance:webView:challenge:completion:) + 536 (WebKitLibrary.g.swift:4354)
9 webview_flutter_wkwebview 0x0000000104a381a8 thunk for @escaping @callee_guaranteed (@in_guaranteed Any?) -> () + 84 (/<compiler-generated>:0)
10 Flutter 0x0000000105a6ea0c __48-[FlutterBasicMessageChannel sendMessage:reply:]_block_invoke + 92 (FlutterChannels.mm:117)
11 Flutter 0x00000001054f246c flutter::PlatformMessageResponseDarwin::Complete(std::_fl::unique_ptr<fml::Mapping, std::_fl::default_delete<fml::Mapping>>)::$_0::operator()() + 120 (platform_message_response_darwin.mm:24)
12 Flutter 0x00000001054f246c auto fml::internal::CopyableLambda<flutter::PlatformMessageResponseDarwin::Complete(std::_fl::unique_ptr<fml::Mapping, std::_fl::default_delete<fml::Mapping>>)::$_0>::operator()<>() const + 124 (make_copyable.h:24)
13 Flutter 0x00000001054f246c decltype(std::declval<fml::internal::CopyableLambda<flutter::PlatformMessageResponseDarwin::Complete(std::_fl::unique_ptr<fml::Mapping, std::_fl::default_delete<fml::Mapping>>)::$_0>&>()()) std::_f... + 124 (invoke.h:403)
14 Flutter 0x00000001054f246c void std::_fl::__invoke_void_return_wrapper<void, true>::__call<fml::internal::CopyableLambda<flutter::PlatformMessageResponseDarwin::Complete(std::_fl::unique_ptr<fml::Mapping, std::_fl::default_d... + 124 (invoke.h:488)
15 Flutter 0x00000001054f246c std::_fl::__function::__alloc_func<fml::internal::CopyableLambda<flutter::PlatformMessageResponseDarwin::Complete(std::_fl::unique_ptr<fml::Mapping, std::_fl::default_delete<fml::Mapping>>)::$_0>, ... + 124 (function.h:185)
16 Flutter 0x00000001054f246c std::_fl::__function::__func<fml::internal::CopyableLambda<flutter::PlatformMessageResponseDarwin::Complete(std::_fl::unique_ptr<fml::Mapping, std::_fl::default_delete<fml::Mapping>>)::$_0>, std::_... + 140 (function.h:359)
17 Flutter 0x0000000105516858 std::_fl::__function::__value_func<void ()>::operator()[abi:v15000]() const + 12 (function.h:512)
18 Flutter 0x0000000105516858 std::_fl::function<void ()>::operator()() const + 12 (function.h:1187)
19 Flutter 0x0000000105516858 fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 592 (message_loop_impl.cc:126)
20 Flutter 0x0000000105519e5c fml::MessageLoopImpl::RunExpiredTasksNow() + 8 (message_loop_impl.cc:139)
21 Flutter 0x0000000105519e5c fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 32 (message_loop_darwin.mm:85)
22 CoreFoundation 0x00000001918f2894 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32 (CFRunLoop.c:1810)
23 CoreFoundation 0x00000001918f2538 __CFRunLoopDoTimer + 1012 (CFRunLoop.c:2417)
24 CoreFoundation 0x00000001918f208c __CFRunLoopDoTimers + 288 (CFRunLoop.c:2575)
25 CoreFoundation 0x00000001918913b4 __CFRunLoopRun + 1856 (CFRunLoop.c:3136)
26 CoreFoundation 0x0000000191890830 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434)
27 GraphicsServices 0x00000001dd8701c4 GSEventRunModal + 164 (GSEvent.c:2196)
28 UIKitCore 0x00000001943f6eb0 -[UIApplication _run] + 816 (UIApplication.m:3844)
29 UIKitCore 0x00000001944a55b4 UIApplicationMain + 340 (UIApplication.m:5496)
30 UIKitCore 0x00000001947dffa8 UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:565)
31 Runner 0x00000001045096fc specialized static UIApplicationDelegate.main() + 28 (/<compiler-generated>:5)
32 Runner 0x00000001045096fc static AppDelegate.$main() + 28 (AppDelegate.swift:0)
33 Runner 0x00000001045096fc main + 120
34 dyld 0x00000001b727eec8 start + 2724 (dyldMain.cpp:1334)
Expected results
Not to crash
Actual results
Crashing
Code sample
I don't have a code example but you can just install this dependency reown_appkit: ^1.4.0-beta03 (which is actually our package and uses webview_flutter internally) and run this code:
Code sample
import 'package:flutter/material.dart';
import 'package:reown_appkit/reown_appkit.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
late ReownAppKitModal _appKitModal;
@override
void initState() {
super.initState();
_appKitModal = ReownAppKitModal(
context: context,
projectId: '07429c7285515de0715980519ef2e148',
logLevel: LogLevel.all,
featuresConfig: FeaturesConfig(
email: true,
socials: [
AppKitSocialOption.Farcaster,
AppKitSocialOption.X,
AppKitSocialOption.Apple,
AppKitSocialOption.Discord,
],
showMainWallets: true, // OPTIONAL - true by default
),
metadata: const PairingMetadata(
name: 'Example App',
description: 'Example app description',
url: 'https://reown.com/',
icons: ['https://reown.com/logo.png'],
redirect: Redirect(
native: 'exampleapp://',
universal: 'https://reown.com/exampleapp',
),
),
);
_appKitModal.init();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppKitModalNetworkSelectButton(
appKit: _appKitModal,
context: context,
),
AppKitModalConnectButton(
appKit: _appKitModal,
context: context,
),
Visibility(
visible: _appKitModal.isConnected,
child: AppKitModalAccountButton(
context: context,
appKitModal: _appKitModal,
),
)
],
),
),
);
}
}You are gonna see that the app crashes only on release mode.
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.1.1 24B91 darwin-arm64, locale en-US)
• Flutter version 3.24.5 on channel stable at /Users/alfreedom/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision dec2ee5c1f (3 months ago), 2024-11-13 11:13:06 -0800
• Engine revision a18df97ca5
• Dart version 3.5.4
• DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/alfreedom/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = /Users/alfreedom/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
[✓] VS Code (version 1.96.4)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.102.0
[✓] Connected device (4 available)
• iPhone 15 Alfreedom (mobile) • 00008120-000C5CD63472201E • ios • iOS 18.1.1 22B91
• macOS (desktop) • macos • darwin-arm64 • macOS 15.1.1 24B91 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.1.1 24B91 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.179
! Error: Browsing on the local area network for Apple Watch Alfreedom. Ensure the device is unlocked and discoverable via Bluetooth. (code -27)
[✓] Network resources
• All expected network resources are available.