Preguntas frecuentes sobre la integración de IOS con flutter_boost 3.0

no hay tal módulo flutter_boost

aparece la escena

Después de que IOS integre flutter_boost, compile y ejecute el proyecto, y se informa el siguiente error,
que indica que no existe tal módulo 'flutter_boost'

código

import UIKit
import flutter_boost

class BoostDelegate: NSObject,FlutterBoostDelegate {
    
    
    
    ///您用来push的导航栏
    var navigationController:UINavigationController?
    
    ///用来存返回flutter侧返回结果的表
    var resultTable:Dictionary<String,([AnyHashable:Any]?)->Void> = [:];
    
    func pushNativeRoute(_ pageName: String!, arguments: [AnyHashable : Any]!) {
    
    
        
        //可以用参数来控制是push还是pop
        let isPresent = arguments["isPresent"] as? Bool ?? false
        let isAnimated = arguments["isAnimated"] as? Bool ?? true
        //这里根据pageName来判断生成哪个vc,这里给个默认的了
        var targetViewController = UIViewController()
        
        if(isPresent){
    
    
            self.navigationController?.present(targetViewController, animated: isAnimated, completion: nil)
        }else{
    
    
            self.navigationController?.pushViewController(targetViewController, animated: isAnimated)
        }
    }
    
    func pushFlutterRoute(_ options: FlutterBoostRouteOptions!) {
    
    
        let vc:FBFlutterViewContainer = FBFlutterViewContainer()
        vc.setName(options.pageName, uniqueId: options.uniqueId, params: options.arguments,opaque: options.opaque)
        
        //用参数来控制是push还是pop
        let isPresent = (options.arguments?["isPresent"] as? Bool)  ?? false
        let isAnimated = (options.arguments?["isAnimated"] as? Bool) ?? true
        
        //对这个页面设置结果
        resultTable[options.pageName] = options.onPageFinished;
        
        //如果是present模式 ,或者要不透明模式,那么就需要以present模式打开页面
        if(isPresent || !options.opaque){
    
    
            self.navigationController?.present(vc, animated: isAnimated, completion: nil)
        }else{
    
    
            self.navigationController?.pushViewController(vc, animated: isAnimated)
        }
    }
    
    func popRoute(_ options: FlutterBoostRouteOptions!) {
    
    
        //如果当前被present的vc是container,那么就执行dismiss逻辑
        if let vc = self.navigationController?.presentedViewController as? FBFlutterViewContainer,vc.uniqueIDString() == options.uniqueId{
    
    
            
            //这里分为两种情况,由于UIModalPresentationOverFullScreen下,生命周期显示会有问题
            //所以需要手动调用的场景,从而使下面底部的vc调用viewAppear相关逻辑
            if vc.modalPresentationStyle == .overFullScreen {
    
    
                
                //这里手动beginAppearanceTransition触发页面生命周期
                self.navigationController?.topViewController?.beginAppearanceTransition(true, animated: false)
                
                vc.dismiss(animated: true) {
    
    
                    self.navigationController?.topViewController?.endAppearanceTransition()
                }
            }else{
    
    
                //正常场景,直接dismiss
                vc.dismiss(animated: true, completion: nil)
            }
        }else{
    
    
            self.navigationController?.popViewController(animated: true)
        }
        //否则直接执行pop逻辑
        //这里在pop的时候将参数带出,并且从结果表中移除
        if let onPageFinshed = resultTable[options.pageName] {
    
    
            onPageFinshed(options.arguments)
            resultTable.removeValue(forKey: options.pageName)
        }
    }
}

inserte la descripción de la imagen aquí

solución

Al principio pensé que la cápsula no dependía del éxito, pero después de mucho tiempo de tirarla, descubrí que seguía igual.
Finalmente encontré la solución en StackOverFlow Obteniendo el error "No existe tal módulo" usando Xcode, pero el marco está ahí .
Resulta que la forma en que se abre xcode es incorrecta. Al principio, el proyecto ios se abrió a través de xcodeproj, y el proyecto ios debe abrirse a través de xcworkspace para poder confiar en él correctamente.
inserte la descripción de la imagen aquí

Supongo que te gusta

Origin blog.csdn.net/adojayfan/article/details/123892455
Recomendado
Clasificación