flutter_boost [Bug]: FlutterBoost exceptions on iOS.

cgvd09ve  于 5个月前  发布在  Flutter
关注(0)|答案(2)|浏览(54)

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

[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)
<asynchronous suspension>
#1      MethodChannelConnectivity.checkConnectivity.<anonymous closure> (package:connectivity_plus_platform_interface/method_channel_connectivity.dart:41:15)
<asynchronous suspension>
#2      ConnectionManagerController.getConnectivityType (package:flutter_module_favorites/network/utils/connection_manager_controller.dart:34:28)
<asynchronous suspension>
[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)
<asynchronous suspension>
#1      FlutterBoostAppState._restoreStackForHotRestart (package:flutter_boost/src/flutter_boost_app.dart:215:19)
<asynchronous suspension>
[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)
<asynchronous suspension>
#1      FlutterBoostAppState._saveStackForHotRestart (package:flutter_boost/src/flutter_boost_app.dart:210:5)
<asynchronous suspension>

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

  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<UISceneSession>) {
    // 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

解决方案

9ceoxa92

9ceoxa921#

We are witnessing that flutter boost isn't picking up routes that we provide from native iOS side.

6pp0gazn

6pp0gazn2#

When we create a dummy Flutter Engine, we are able to silence these exceptions but our native pigeon communications don't work with FlutterBoost engine's binary messenger.

var flutterEngine = FlutterEngine(name: "FlutterBoostPlugin") flutterEngine.run() GeneratedPluginRegistrant.register(with: flutterEngine)

相关问题