0

I had used a lots and lots of solutions for the past 3 days, but still i couldn't get rid of this issue, please help me out.

Xcode's output:
↳
In file included from 
/Users/hxtreme/Desktop/MobileApp/flutter/.pub- 
cache/hosted/pub.dartlang.org/wakelock- 
0.5.6/ios/Classes/WakelockPlugin.m:1:
/Users/hxtreme/Desktop/MobileApp/flutter/.pub- 
cache/hosted/pub.dartlang.org/wakelock- 
0.5.6/ios/Classes/WakelockPlugin.h:1:9: fatal error: 
'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro.

Im using Flutter v2.8.1, i also tried with different versions like v2.5.1, v2.10.1, but no use... and also tried with various stackoverflow solutions but didn't helped me out.

POD FILE:

# Uncomment this line to define a global platform for your project
platform :ios, '15.2'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
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

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.frameworks_group["iOS"]["MobileCoreServices.framework"].remove_from_project
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.2'
    end
  end
end

Thanks in Advance!

New error after done below solution

/Users/hxtreme/Desktop/MobileApp/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ffmpeg-0.4.2/ios/Classes/FlutterExecuteDelegate.h:21:9: fatal error: 'mobileffmpeg/ExecuteDelegate.h' file not found
    #import <mobileffmpeg/ExecuteDelegate.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
In file included from /Users/hxtreme/Desktop/MobileApp/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ffmpeg-0.4.2/ios/Classes/EmptyLogDelegate.m:20:
/Users/hxtreme/Desktop/MobileApp/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ffmpeg-0.4.2/ios/Classes/EmptyLogDelegate.h:20:10: fatal error: 'mobileffmpeg/LogDelegate.h' file not found
    #include <mobileffmpeg/LogDelegate.h>
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/hxtreme/Desktop/MobileApp/bemeli_app/ios/Pods/Pods.xcodeproj: warning: MobileCoreServices has been renamed. Use CoreServices instead. (in target 'GCDWebServer' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro.
Abilash S
  • 1
  • 1
  • Does this answer your question? [error: 'Flutter/Flutter.h' file not found when flutter run on iOS](https://stackoverflow.com/questions/64973346/error-flutter-flutter-h-file-not-found-when-flutter-run-on-ios) – Ashutosh singh Feb 16 '22 at 07:44
  • hello under my answer i have post a comment that is the answer your next problem with the IPHONEOS_DEPLOYMENT_TARGET – liam spiegel Feb 17 '22 at 10:05

1 Answers1

0

Change your Podfile

from this

post_install do |installer|
  installer.pods_project.frameworks_group["iOS"]["MobileCoreServices.framework"].remove_from_project
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.2'
    end
  end
end

to this

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
Anand
  • 4,355
  • 2
  • 35
  • 45
  • try this and ping me whether works or not – Anand Feb 16 '22 at 06:51
  • When i did this, it shows different error like app/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'PINCache' from project 'Pods') – Abilash S Feb 16 '22 at 09:15