fluttercocoapodsflutter-dependenciespodspec

Custom Flutter plugin development for iOS


I am trying to develop a custom Flutter plugin for iOS.

The customer has shared a Vendor-specific private SDK (Not available in Cocoapods repo) for interacting with external hardware. SDK is in *.framework format.

So I created a new plugin. Inside the plugin, I want to add the SDK dependencies in .podspec file from a local path. How to add this dependency? Is it the right approach or do we have any other option to resolve this problem? Kindly help me.


Solution

  • I was able to resolve this issue by providing all vendor-specific frameworks as s.vendored_frameworks in the podspec configuration of the plugin.

    s.vendored_frameworks = 'x1.framework','x2.framework','x3.framework',

    Pod::Spec.new do |s|
      s.name             = 'ble'
      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@example.com' }
      s.source           = { :path => '.' }
      s.source_files = 'Classes/**/*'
      s.public_header_files = 'Classes/**/*.h'
    
    
      s.ios.deployment_target = '10.0'
      s.requires_arc = true
      s.ios.frameworks = 'Foundation', 'CoreTelephony', 'Security', 'CoreLocation', 'CoreBluetooth', 'CoreMotion', 'UIKit', 'SystemConfiguration', 'LocalAuthentication', 'CoreML'
      s.dependency 'Flutter'
      s.vendored_frameworks = 'SeosMobileKeysSDK.framework','BerTlv.framework','CocoaLumberjack.framework','JSONModel.framework','Mixpanel.framework'
    
    end
    
    

    All framework libraries are placed in the plugin folder itself

    enter image description here