Saturday, November 21, 2026
HomeiOS DevelopmentFlutter can't name end in native ios code

Flutter can’t name end in native ios code

[ad_1]

Good day, perhaps somebody may also help me right here. I’ve a SDK constructed into Flutter that I name by way of the ChannelMethod. There I enter a callback whose end result I need to give again to flutter. The callback works however for some unknown purpose the end result operate will not be triggered.

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func software(
    _ software: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
    let testChannel = FlutterMethodChannel(identify: "take a look at",
                                              binaryMessenger: controller.binaryMessenger)
    testChannel.setMethodCallHandler({
        [weak self] (name: FlutterMethodCall, end result: @escaping FlutterResult) -> Void in
      // This methodology is invoked on the UI thread.
      guard name.methodology == "startProcess" else {
          end result(FlutterMethodNotImplemented)
        return
      }
        
    let args = name.arguments as! Dictionary<String, Any>

        let mainVC = ViewController()
        mainVC.callBack = { (resultValue: String) in
            print("Callback known as:")
            print(resultValue)
            // <-------- this doesn't work -------->
            end result(resultValue)
            end result("take a look at")
          };
        mainVC.caseId = args["caseId"] as! String
        let navigationController = UINavigationController(rootViewController: mainVC)
    self?.window.rootViewController = navigationController
    self?.window.makeKeyAndVisible()
    })
    
    GeneratedPluginRegistrant.register(with: self)
    return tremendous.software(software, didFinishLaunchingWithOptions: launchOptions)
  }
}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments