2

enter image description hereAn Error occured while using the image_picker and image_cropper it shows me that "Module 'image_picker_ios' not found"

image

Ravindra S. Patil
  • 11,757
  • 3
  • 13
  • 40
Flutter Dev
  • 488
  • 3
  • 18
  • Hello @hassan, can you share more info or logs for this issue? are you using package or using this as a declaration in pubspec.yaml – AshishVE May 11 '22 at 13:17
  • @AshishVE hello, yes i'm using image_picker package, first it works fine, when i added the image cropper package then errors occured. – Flutter Dev May 11 '22 at 13:19
  • whats the version of xcode? thus its the latest? – Arbiter Chil May 11 '22 at 13:33
  • This may be helpful i guess: https://stackoverflow.com/questions/64659850/how-to-solve-this-problem-module-image-picker-not-found-on-xcode – AshishVE May 11 '22 at 13:42

2 Answers2

0
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
platform :ios, '9.0'
project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

I have just added above this code on PodFile and issues solved.

0

In my case, the source of package in the ios/.symlinks/plugins/image_picker_ios/ios/image_picker_ios.podspec was wrong. Previous code:

#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
  s.name             = 'image_picker_ios'
  s.version          = '0.0.1'
  s.summary          = 'Flutter plugin that shows an image picker.'
  s.description      = <<-DESC
A Flutter plugin for picking images from the image library, and taking new pictures with the camera.
Downloaded by pub (not CocoaPods).
                       DESC
  s.homepage         = 'https://github.com/flutter/packages'
  s.license          = { :type => 'BSD', :file => '../LICENSE' }
  s.author           = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
  s.source           = { :http => 'https://github.com/flutter/packages/tree/main/packages/image_picker_ios' }
  s.documentation_url = 'https://pub.dev/packages/image_picker_ios'
  s.source_files = 'Classes/**/*.{h,m}'
  s.public_header_files = 'Classes/**/*.h'
  s.module_map = 'Classes/ImagePickerPlugin.modulemap'
  s.dependency 'Flutter'
  s.platform = :ios, '11.0'
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
end

Now I have changed the s.source to:

s.source           = { :http => 'https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_ios' }