flutter-devs / image_gallery

A Flutter plugin to view images from Android/iOS gallery.
Other
39 stars 24 forks source link

Getting podspec not found Error #1

Open v2Nitesh opened 5 years ago

v2Nitesh commented 5 years ago

Hi, This looks very good framework. It was working fine on Android but when I am trying to run on iOS it's giving me error related to Pod but after pod install it's giving me below error.

Analyzing dependencies Fetching podspec for Flutter from .symlinks/flutter/ios Fetching podspec for image_gallery from .symlinks/plugins/image_gallery/ios [!] No podspec found for image_gallery in .symlinks/plugins/image_gallery/ios

Please help me to resolve this issues.

Ahmadre commented 5 years ago

That's because they call their pod: flutter_gallary_plugin, instead of: image_gallery.

So at first change the filename of flutter_gallary_plugin.podspec to: image_gallery.podspec. After that change the podspec as follows:

Pod::Spec.new do |s|
  s.name             = 'image_gallery'
  s.version          = '0.0.1'
  s.summary          = 'A new Flutter plugin.'
  s.description      = <<-DESC
A new Flutter plugin.
                       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.dependency 'Flutter'
  s.swift_version = '4.1'
  s.ios.deployment_target = '9.0'
end

I configured in my XCode project the swift version and set it for the pods, but only this configuration will run it.

At last step, your *.m class in ios/Classes/ should import the Swift file like this:

#import "FlutterGallaryPlugin.h"
#import <image_gallery/image_gallery-Swift.h>

@implementation FlutterGallaryPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
  [SwiftFlutterGallaryPlugin registerWithRegistrar:registrar];
}
@end
yasinarik commented 4 years ago

I had an hard time finding the flutter_gallary_plugin.podspec file.

Here is the relative path of that file: /root/of/your/project/ios/.symlinks/plugins/image_gallery/ios/flutter_gallary_plugin.podspec

severin13 commented 4 years ago

Hi, I am building my app on Codemagic since I do work on Windows and I am getting the same error when building for iOS:

Fetching external sources -> Fetching podspec for Flutter from Flutter -> Fetching podspec for image_gallery from .symlinks/plugins/image_gallery/ios [!] No podspec found for image_gallery in .symlinks/plugins/image_gallery/ios

It does not seem that Codemagic is installing the dependencies from my local setup, so I am unable to change the .podspec file as it gets directly downloaded from source. Any idea to solve this? I have tried to get a pod installed on Windows but without any luck...

Thanks in advance for any help with this!

swati-kapoor commented 3 years ago

@severin13 Replace this in pubspec.yaml image_gallery: git: url: https://github.com/swati-kapoor/image_gallery.git

  It will work