Flutter for iOS

如何把Flutter编译后的文件pod到远端(仅适用iOS)

2019-03-01  本文已影响3人  鸿伟x

接上篇https://www.jianshu.com/p/700bd7d2122b

上篇讲到如何一键打包Flutter, 集成到iOS原有项目;
本文讲如何把Flutter编译后的产物pod到远端;

01在打包后的build_for_ios文件夹创建xxxx.podspec文件

xxxx.podspec内容如下
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
#

Pod::Spec.new do |s|
  s.name             = 'DATKFlutterSDK'
  s.version          = '1.x'
  s.summary          = 'DATKFlutterSDK模块'
  s.description      = <<-DESC
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
                       DESC
  s.homepage         = 'https://flutter.io'
  s.license          = { :type => 'MIT' }
  s.author           = { 'Flutter Dev Team' => 'duia@duia.com' }
  s.source           = { :git => 'git@git.xxx.xxx.com/XXXFlutterSDK.git', :tag => s.version.to_s }#这一行代码不重要,因为外面引用时会直接指定tag,所以此行代码理论上是无效的
  s.ios.deployment_target = '8.0'

  s.vendored_frameworks = '*.framework',
  s.source_files =  "Classes", "*.{h,m}"
  s.public_header_files = '*.h'
  
  s.source           = { :path => '.' }

  s.resources = ['flutter_assets']
end

build_for_ios文件夹内容如下


WX20190301-144101.png

02直接把build_for_ios文件夹内的内容推送到git服务器,打上tag, 然后iOS就能直接使用了

ios原项目只需在podfile中添加如下一句话,即可完成flutter的集成
详情请跳转至https://www.jianshu.com/p/33cd6deab1d3

pod 'DATKFlutterSDK', :git => 'git@git.xxx.xxx.com/XXXFlutterSDK.git', :tag => '1.0.0'
#git@git.xxx.xxx.com/XXXFlutterSDK.git为您的git远端地址

(注:由于flutter编译的时候只编译了真机版的,所以不支持在iOS模拟器上运行)

上一篇下一篇

猜你喜欢

热点阅读