0

I have a Flutter project that works fine on Android, but I can't run it on iOS. The build always fails.

SDWebImage shows an Arc Semantic Issue.

/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m:31:40: No visible @interface for 'UIImage' declares the selector 'imageByPreparingForDisplay'

/ios/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m:48:40: No visible @interface for 'UIImage' declares the selector 'imageByPreparingThumbnailOfSize:'

What I've tried already:

Cleaned everything

  1. deleted the DerivedData folder
  2. closed Xcode
  3. rm -rf Podfile.lock
  4. rm -rf pubspec.lock
  5. rm -rf Pods
  6. pod repo update
  7. pod cache clean --all
  8. pod deintegrate
  9. flutter clean
  10. flutter pub get
  11. pod setup
  12. pod install --repo-update

Changed the iOS version

  • I can't go lower than iOS 13.0 because of some dependencies
  • Tried iOS 13, iOS 14, iOS 14.4, iOS 14.5

Tried on Xcode 12 and Xcode 13

Tried to change the targeted pod with errors to public instead of project

Tried to build for the simulator, Archive or just build (command + b)

The Flutter version I'm using is 3.0.4

Edit: This is my Podfile

 platform :ios, '14.4'
  use_modular_headers!

>

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

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

    pod 'GeoFire', :git => 'https://github.com/heinzan/geofire-objc'

     pod 'Firebase', :modular_headers => true
     pod 'FirebaseCore', :modular_headers => true
     pod 'GoogleUtilities', :modular_headers => true
     $RNFirebaseAsStaticFramework = true


target 'Runner' do
  use_frameworks!
   #use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
          config.build_settings['ARCHS[sdk=iphonesimulator*]'] =  `uname -m`
          
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.4'

    end
    flutter_additional_ios_build_settings(target)
  end
 end


  target 'OneSignalNotificationServiceExtension' do
    # Comment the next line if you don't want to use dynamic frameworks
    use_frameworks!
    pod 'OneSignalXCFramework', '>= 3.0.0', '< 4.0'
  end
```
mvpires
  • 43
  • 1
  • 6
  • did you found any working solution instead of deleting iOS folder i am using react-native – Nicks Sep 05 '22 at 11:05
  • Sadly, no. I think when I updated to Flutter 3, it changed something else in the project and with the recreation of the folder, it fixed the issue. It was my last resort. – mvpires Sep 19 '22 at 13:57

2 Answers2

0

Try adding use framework in podfile like

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

You must already have Target runner do. Just as use frameworks

Kaushik Chandru
  • 15,510
  • 2
  • 12
  • 30
  • Thanks Kaushik, but I'm using it already. I'm going to update my question to include my podfile. – mvpires Aug 15 '22 at 19:40
0

I ended up deleting the ios folder and recreating with flutter create .

mvpires
  • 43
  • 1
  • 6
  • Hey mvpires, what exact command do I do in terminal to recreate the ios folder? Also do I run it from my flutter project directory or anywhere specific? I keep trying `flutter create`, but it either creates a new project in my project, or says `my_project` isn't a valid dart file. I can't seem to just get the ios folder replaced. – Powermaster Prime Oct 02 '22 at 05:32
  • What I did wasn't the best way, but it was what I could do within the time constraints that I had was to run the flutter create command then copying the ios folder from it and replace the "old" one after making backup copy. It's horrible, but it worked for me haha. Sorry. – mvpires Oct 05 '22 at 13:23