Flutter 无法为 IOS 构建
我正在使用 flutter 2.10.3
我创建了一个新项目,我能够在 simulator iphone 8
上运行,但是当我运行 flutter build ios
时我收到以下错误。
The following build commands failed:
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'vibration' from project 'Pods')
Ld
/Users/bilalrabbi/Library/Developer/Xcode/DerivedData/Runner-eqtwcanhgaiurgblzcjnjgoffipl/Build/Intermediates.noindex/Pods.build/Release-iphoneos/shared_preferences_ios.buil
d/Objects-normal/armv7/Binary/shared_preferences_ios normal armv7 (in target 'shared_preferences_ios' from project 'Pods')
(2 failures)
我
[ +320 ms] Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code
[ +6 ms] Error (Xcode): Framework not found Flutter
已经删除了 pod 文件。删除派生数据。更新 pod 缓存,但似乎没有任何效果。当我尝试再次构建时,我收到此错误 这是我的 PodFile,
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# 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.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end
end
end
我也尝试过使用 platform :ios, '11.0'
I am using flutter 2.10.3
I have created a new project i was able to run on simulator iphone 8
but when i run flutter build ios
i am getting below error.
The following build commands failed:
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'vibration' from project 'Pods')
Ld
/Users/bilalrabbi/Library/Developer/Xcode/DerivedData/Runner-eqtwcanhgaiurgblzcjnjgoffipl/Build/Intermediates.noindex/Pods.build/Release-iphoneos/shared_preferences_ios.buil
d/Objects-normal/armv7/Binary/shared_preferences_ios normal armv7 (in target 'shared_preferences_ios' from project 'Pods')
(2 failures)
and
[ +320 ms] Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code
[ +6 ms] Error (Xcode): Framework not found Flutter
I have removed pod files. delete derived data. update pod cache but nothing seems to work. When i try to build again i am getting this error
Here is my PodFile
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# 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.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |build_configuration|
build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end
end
end
I also tried with platform :ios, '11.0'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试删除flutter SDK并重新安装
然后在项目文件夹中运行这些命令
,然后切换到 ios 文件夹并运行
“现在尝试构建”。
try deleting flutter SDK and re-install it
then run these commands in the project folder
then switch to the ios folder and run
Now try to build.