2

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.

Abhishek Patil
  • 1,373
  • 3
  • 30
  • 62
John_S
  • 532
  • 4
  • 10

1 Answers1

2

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

John_S
  • 532
  • 4
  • 10
  • Where did you put your x1.framework folder ? At the same level as the plugin or other path? – Arton Hoxha Nov 08 '22 at 17:34
  • Yes, the framework files are placed in the same folder. – John_S Nov 10 '22 at 10:40
  • Thanks, unfortunately it did not work for me. This other solution worked: https://stackoverflow.com/questions/54476458/how-to-use-objective-c-framework-in-a-swift-written-ios-part-of-a-flutter-plugin/70313210?noredirect=1#comment131315650_70313210 – Arton Hoxha Nov 11 '22 at 08:27