alibaba / alibaba/flutter_boost

[Bug]: FlutterBoost exceptions on iOS.

Open
#1,972 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
7.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

### 请描述遇到的问题,以及您所期望的正确的结果

```
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method check on channel dev.fluttercommunity.plus/connectivity)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:320:7)

#1 MethodChannelConnectivity.checkConnectivity. (package:connectivity_plus_platform_interface/method_channel_connectivity.dart:41:15)

#2 ConnectionManagerController.getConnectivityType (package:flutter_module_favorites/network/utils/connection_manager_controller.dart:34:28)

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
#0 NativeRouterApi.getStackFromHost (package:flutter_boost/src/messages.dart:257:7)

#1 FlutterBoostAppState._restoreStackForHotRestart (package:flutter_boost/src/flutter_boost_app.dart:215:19)

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
#0 NativeRouterApi.saveStackToHost (package:flutter_boost/src/messages.dart:284:7)

#1 FlutterBoostAppState._saveStackForHotRestart (package:flutter_boost/src/flutter_boost_app.dart:210:5)

```
Screenshot 2024-02-29 at 3 13 13 PM
Screenshot 2024-02-29 at 3 13 55 PM

### 请说明如何操作会遇到上述问题

1. flutter build ios-framework
2. Take out debug xcframeworks and add in a sample project.

### 在下面填入关键复现代码

```
@main
class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

let delegate = BoostDelegate()

FlutterBoost.instance().setup(application, delegate: delegate, callback: { engine in
debugPrint(engine)
})

// FlutterBoost.instance().sendEventToFlutter(with: "appArgs", arguments: ["language": "en", "environment": "com"])
// FlutterBoost.instance().sendEventToFlutter(with: "loginUser", arguments: [:])

return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}

```

### 复现的平台

iOS

### Flutter SDK版本

3.16.9

### FlutterBoost版本

5.0.1

### 是否延迟初始化FlutterBoost

No

### 解决方案

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with `flutter build ios-framework`, then add the debug XCFrameworks to a sample iOS project. Start with the stack traces in `flutter_boost/src/messages.dart`, `flutter_boost/src/flutter_boost_app.dart`, and the reported connectivity call; done means the sample project no longer produces these channel and plugin exceptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter, ios
Domain
mobile, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.