在过去的三天里,我使用了很多很多的解决方案,但是我仍然无法摆脱这个问题,请帮助我。
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.
我使用的是颤振v2.8.1,我也尝试了不同的版本,如v2.5.1,v2.10.1,但没有使用.也尝试过各种堆叠溢出解决方案,但没有帮到我。
POD文件:
# 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
提前谢谢!
在以下解决方案完成后出现新的错误
/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.
发布于 2022-02-16 06:51:15
更改您的Podfile
来自这个的
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
到此
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
发布于 2022-02-17 07:05:14
要解决该错误,请继续执行以下步骤:
运行程序备份运行程序directory
flutter create .
pod install
中的ios directory
pod deintegrate
中,也在flutter项目directory
flutter pub get
flutter run
中的ios directory
flutter clean
中执行flutter create .
请注意,如果使用firebase,则需要重新插入GoogleService-Info.plist文件
我希望这个答案有帮助。
https://stackoverflow.com/questions/71137258
复制相似问题