美文网首页
4.2.iOS原生嵌入flutter_module

4.2.iOS原生嵌入flutter_module

作者: ChaosHeart | 来源:发表于2020-09-08 09:17 被阅读0次

    1.创建一个iOS原生项目

    2.创建一个flutter_module

    (1)命令行创建

    flutter create -t module flutter_module
    

    (2)as创建


    截屏2020-09-07 17.46.06.png
    截屏2020-09-07 17.49.07.png
    截屏2020-09-07 17.49.17.png

    (3)给iOS项目使用cocoapods

    # Uncomment the next line to define a global platform for your project
    
    flutter_application_path = '../flutter_module'
    load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
    
    platform :ios, '9.0'
    
    target 'NativeDemo' do
    
      install_all_flutter_pods(flutter_application_path)
      use_frameworks!
    
      # Pods for NativeDemo
    
    end
    
    

    将上面的复制到Podfile中
    ../flutter_module : 相对路径(根据创建的flutter_module修改)
    NativeDemo : iOS项目名(根据iOS原生项目名修改)

    (3)然后重新pod install

    pod install
    

    (4)如果报错,参考:
    https://www.jianshu.com/p/2a2e300a938b

    相关文章

      网友评论

          本文标题:4.2.iOS原生嵌入flutter_module

          本文链接:https://www.haomeiwen.com/subject/axylektx.html