Open JuanFcoMiranda opened 1 year ago
I don't have much idea on what could be the problem sorry. You can try dart pub cache repair
. Does it happen when you open the example app ?
same issue. @alextekartik yes it works properly on new app but not on existing project
Sometimes one solution is to re-create the flutter ios project.
This error message is indicating that the Flutter/Flutter.h header file cannot be found in your Xcode project, which is required by the sqflite library.
Try the following steps to resolve the issue:
Run flutter clean in the terminal to clean the build files. Delete the ios and android directories in your Flutter project. Run flutter pub cache repair to repair the pub cache. Finally, run flutter run again to build and run your app. If the issue persists, try uninstalling and reinstalling the sqflite package by removing the sqflite entry from your pubspec.yaml file and then running flutter pub get. Finally, add the sqflite entry back to your pubspec.yaml file and run flutter pub get again.
If none of these steps work, it's possible that there is a compatibility issue between the version of sqflite you are using and the version of Flutter you have installed. Try downgrading or upgrading either sqflite or Flutter to see if that resolves the issue.
Here is the solution that worked for me,
Backup ios/Runner folder. Delete the ios folder.
Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
If flutter run fails:
cd ios pod install cd .. flutter run
And also do this in your info.plist file in ios/Runner/ folder Changing PodFile from:
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0' end end end to
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end
sqflite plugin comes first in the error, but this has nothing to do with the plugin, you simply need to update your Podfile such as :
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
This will target in my case iOS 13 for all of my dependencies.
Hi, can anyone help me pls? I have this Podfile:
platform :ios, '13.0'
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
def flutter_install_ios_plugin_pods(ios_application_path = nil)
ios_application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
raise 'Could not find iOS application path' unless ios_application_path
symlink_dir = File.expand_path('.symlinks', ios_application_path)
system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.
symlink_plugins_dir = File.expand_path('plugins', symlink_dir)
system('mkdir', '-p', symlink_plugins_dir)
plugins_file = File.join(ios_application_path, '..', '.flutter-plugins-dependencies')
plugin_pods = flutter_parse_plugins_file(plugins_file)
plugin_pods.each do |plugin_hash|
plugin_name = plugin_hash['name']
plugin_path = plugin_hash['path']
if (plugin_name && plugin_path)
symlink = File.join(symlink_plugins_dir, plugin_name)
File.symlink(plugin_path, symlink)
if plugin_name == 'flutter_ffmpeg'
pod 'flutter_ffmpeg/full-lts', :path => File.join('.symlinks', 'plugins', plugin_name, 'ios')
else
pod plugin_name, :path => File.join('.symlinks', 'plugins', plugin_name, 'ios')
end
end
end
end
use_modular_headers!
pod 'Firebase/Core'
pod 'Firebase/Analytics'
pod 'Firebase/Database'
pod 'Firebase/Messaging'
pod 'GoogleUtilities'
target 'Runner' do
use_frameworks!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
configuration.build_settings['clang_allow_non_modular_includes_in_framework_modules'] = 'yes'
end
end
With this Podfile after cleaning everything I receive the following error:
Failed to build iOS app
Swift Compiler Error (Xcode): No such module 'Flutter'
/Users/valenvila/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/darwin/Classes/messages.g.swift:9:9
Encountered error while building for device.
If I change nothing and run the build command again, I receive this error:
Failed to build iOS app
Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/valenvila/.pub-cache/hosted/pub.dev/permission_handler_apple-9.2.0/ios/Classes/PermissionManager.h:7:8
Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/valenvila/.pub-cache/hosted/pub.dev/permission_handler_apple-9.2.0/ios/Classes/PermissionHandlerPlugin.h:0:8
Encountered error while building for device.
If I change my Podfile to this:
...
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
I encounter this error:
Failed to build iOS app
Lexical or Preprocessor Issue (Xcode): Include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin':
'/Users/valenvila/Projects/olga/olga_app/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h'
/Users/valenvila/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/ios/Classes/FLTFirebasePlugin.h:9:8
Parse Issue (Xcode): Could not build module 'firebase_core'
/Users/valenvila/.pub-cache/hosted/pub.dev/firebase_messaging-14.7.10/ios/Classes/FLTFirebaseMessagingPlugin.m:6:8
Encountered error while building for device.
I really don't know what else to do, I try all the clean, remove folders, remove .lock files, etc. I read the StackOverflow sites regarding this.
thanks @Tom3652!!!!
sqflite plugin comes first in the error, but this has nothing to do with the plugin, you simply need to update your Podfile such as :
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end
This will target in my case iOS 13 for all of my dependencies.
Thanks ✅
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' end end end
add this in your pod file replacing existing
Hi all,
I'm new on Flutter, but whenever I add sqflite to my pubspec.yaml, I got this message when I try to run it on an iOS simulator:
I tried to delete the project and recreate it, but everytime it fails.
What could be the problem?