此文章编辑于flutter1.2版本, flutter后续版本有所变化
接上篇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_libraries = '*.a'
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,
#推送文件到git服务器
git add .
git commit -m "备注信息"
git push
#打标签
git tag 1.0.0
git push --tag
然后iOS就能直接使用了
ios原项目只需在podfile中添加如下一句话,即可完成flutter的集成
#使用":git => :tag =>"这种方式指定tag版本,可以绕过pod服务器的验证,比较方便
pod 'DATKFlutterSDK', :git => 'git@git.xxx.xxx.com/XXXFlutterSDK.git', :tag => '1.0.0'
#git@git.xxx.xxx.com/XXXFlutterSDK.git为您的git远端地址
(注:由于flutter编译的时候只编译了真机版的,所以不支持在iOS模拟器上运行)
如何跳转flutter https://www.jianshu.com/p/33cd6deab1d3