How to use cocoapods with a Flutter plugin?

8,284

Add your pod dependency modifying your ios/flutter_vlc_kit.podspec

s.dependency 'MobileVLCKit'

or with the wanted version

s.dependency 'MobileVLCKit', '3.2'

References:

Then go to your example/ios folder and run pod install.

Then open your Runner.xcworkspace and build your plugin from there.

Note: probably you could encounter this issue - tl;dr (not the best choice) change the build system of XCode to the legacy one.

Share:
8,284
Daniel Oliveira
Author by

Daniel Oliveira

Working with Android native development since 2011. Passionate for Flutter development since 2018.

Updated on December 09, 2022

Comments

  • Daniel Oliveira
    Daniel Oliveira over 1 year

    First, I would like to say that I am not a iOS developer.

    I am trying to develop a VLC plugin for Flutter. For so, I need to add its pod (pod "MobileVlcKit") to a podfile, right? But when I create the project (via the command flutter create -t plugin flutter_vlc_kit), the iOS folder inside the project has no podfile.

    Also, it does not have any of the .xworkspace or .xcodeproj files that I can open on XCODE for code editing:

    enter image description here

    How can I add the vlc kit dependency pod (pod "MobileVlcKit") to this plugin?

  • Daniel Oliveira
    Daniel Oliveira over 5 years
    So, I did what you jsut said, but I still can't see the MobileVLCKit inside my fluter_vlc_kit/ios folder. Just inside the flutter_vlc_kit/example/ios. There is something I am missing here?
  • shadowsheep
    shadowsheep over 5 years
    @DanielOliveira Nope it’s right. You have to code your plugin from the example project. A fast way to open your plugin file from there is cmd+shift+o and then type your filename.
  • Daniel Oliveira
    Daniel Oliveira over 5 years
    Wait, I don't code my plugin into the "SwiftFlutterVlcKitPlugin.swift"? (this file is inside the flutter_vlc_it/ios)
  • shadowsheep
    shadowsheep over 5 years
    @DanielOliveira It’s also in the example project from which you ara able to code, build and test it.
  • shadowsheep
    shadowsheep over 5 years
    @DanielOliveira It’s the same file ;-]
  • Daniel Oliveira
    Daniel Oliveira over 5 years
    If I add "import MobileVLCKit" inside my swift file, it complains with "No such module 'MobileVLCKit' ... :'(
  • shadowsheep
    shadowsheep over 5 years
    Well I actually didn’t try with MobileVLCKit, but I could give it a try once in front of a PC. Btw I suggest you to try playing with your plugin without pods. Maybe put only a log. Then add a very simple pod and try using it. And when you are confident try VLCKit again [-;
  • shadowsheep
    shadowsheep over 5 years
    @DanielOliveira Be aware also that some pods need extra setting to be used on a swift project. So I suggest you to play around also with an objective-c plugin. Just to see if you can use a pod with it and not in a swift project you need to figure it out why. I know, that’s too much things but if you wanna get your hands dirty with plugin development you need a bit inside on the native side.
  • Daniel Oliveira
    Daniel Oliveira over 5 years
  • Benjamín Cáceres Ramirez
    Benjamín Cáceres Ramirez about 2 years
    Hi!! Did you managed to use pods inside a plugin package? Cheers
  • Ayan Das
    Ayan Das almost 2 years
    One more thing if you get some errors like The 'Pods-Runner' target has transitive dependencies that include statically linked binaries while pod install, include s.static_framework = true to the podspec file.