0
I'm trying to add a static library to my Flutter project, it doesn't matter whether it's a plugin or a script, as long as it can be referenced as a module in AppDelegate.swift.
  • I have tried adding a static library in the plugin project. Specifying the source file in the .podspec file. but it not working. So.. What are the steps to add a static library to a flutter plugin project?
  • Because the plugin project can only verify the result in the Example project. How should I confirm whether the static library of the plug-in project has been added successfully? Where to reference the header files of a static library?
Pod::Spec.new do |s|
  s.name             = 'hello'
  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.vendored_libraries = 'Classes/**/*.a'
  s.dependency 'Flutter'
  s.platform = :ios, '11.0'

  # Flutter.framework does not contain a i386 slice.
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
  s.swift_version = '5.0'
end
bakboem
  • 534
  • 4
  • 12
  • You need ffi. check the link below. https://codelabs.developers.google.com/codelabs/flutter-ffigen – HW Kim Jan 15 '23 at 20:58
  • @HWKim Thank you for your reply. You are right FFi is understood to be a more efficient approach, But all the methods of my static plugin are defined on the header file, I need to read it. do you have a good idea – bakboem Jan 16 '23 at 00:45
  • It looks like you mostly just deleted the images without transcribing them(?) – starball Jan 16 '23 at 00:46
  • * my static library from Objective-C .[this answer is help me](https://stackoverflow.com/questions/24002369/how-do-i-call-objective-c-code-from-swift) – bakboem Jan 16 '23 at 14:05

0 Answers0