The last post briefly cleaned up the Podspec syntax for this article about the iOS native module development of Flutter.

Introduction to the

When developing Flutte, we will inevitably encounter native components, plug-ins, and communication with native modules, such as maps, third-party SDKS such as wechat and Alipay, and camera SDKS. We must use native components. Of course, you can also use pub.dev/flutter, but this is not the final solution. Flutter has just developed. If it doesn’t have or doesn’t meet your needs, you have to do it yourself

Usage one, direct quote

This method is relatively simple, like a direct reference in an iOS project, if pod Search can find it.


#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
  s.name             = 'flutter_txmap_plugin'
  s.version          = '0.0.1'
  s.summary          = A Tencent Map Plugin for FlutterFrom page = << -desc DESC S. homepage ='http://example.com'
  s.license          = { :file => '.. /LICENSE' }
  s.author           = { 'Your Company'= >'[email protected]' }
  s.source           = { :path => '. ' }
  s.source_files = 'Classes/**/*'
  s.public_header_files = 'Classes/**/*.h'
  s.dependency 'Flutter'
  ## introduction, can also carry the version number
  s.dependency 'AFNetworking'.'~ > 1.0'

  s.ios.deployment_target = '9.0'
end

Copy the code

Usage 2: Copy the third-party library to a new folder

We can’t directly introduce this method like the first one, because pod Search cannot search Tencent Map, for example. If we encounter this method, we have to download their library and introduce it, for example:

#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
  s.name             = 'flutter_txmap_plugin'
  s.version          = '0.0.1'
  s.summary          = A Tencent Map Plugin for FlutterFrom page = << -desc DESC S. homepage ='http://example.com'
  s.license          = { :file => '.. /LICENSE' }
  s.author           = { 'Your Company'= >'[email protected]' }
  s.source           = { :path => '. ' }
  s.source_files = 'Classes/**/*'
  s.public_header_files = 'Classes/**/*.h'
  s.dependency 'Flutter'
  # Introduce resources, such as the image we want to display the annotation
  s.resources = ['Images/*.png']
  # Tencent map framework library, POD Search should be the early version and the latest API does not correspond
  s.vendored_frameworks = 'Frameworks/QMapKit.framework'.'Frameworks/TencentLBS.framework'

  s.ios.deployment_target = '9.0'
end

Copy the code

Third, if it’s not a framework library instead.afile

Recently, the introduction of a camera SDK and configuration of equipment to the wi-fi, below are. A library, how to introduce this way, and make for a long time, finally in guides.cocoapods.org/syntax/pods… Found as follows:

#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
  s.name             = 'erazl_plugin'
  s.version          = '0.0.1'
  s.summary          = 'A new flutter plugin project.'
  s.description      = <<-DESC
A new flutter plugin project.
                       DESC
  s.homepage         = 'http://example.com'
  s.license          = { :file => '.. /LICENSE' }
  s.author           = { 'Your Company'= >'[email protected]' }
  s.source           = { :path => '. ' }
  s.source_files = 'Classes/**/*'
  s.public_header_files = 'Classes/**/*.h'.'Library/*.h'
  Import all *. A libraries in the Library folder
  s.vendored_libraries = 'Library/*.a'
  s.frameworks = 'MobileCoreServices'.'CFNetwork'.'CoreGraphics'
  The *. A library will not be able to compile
  List of system libraries that the user target (application) needs to link to,
  s.libraries = 'z. 1.2.5'.'c++'.'c'.'iconv. 2.4.0'.'sqlite3'.'stdc++. 6.0.9'.'xml2'.'bz2.1.0'.'resolv'.'xml2'.'z'
  s.dependency 'Flutter'

  s.ios.deployment_target = '9.0'
end


Copy the code

The appeal is a variety of recent problems encountered in the development of iOS native modules, here is a brief summary, if there are other ways to welcome to learn from each other