如何修复这个 Flutter iOS 构建错误?
Posted
技术标签:
【中文标题】如何修复这个 Flutter iOS 构建错误?【英文标题】:How do I fix this Flutter iOS build error? 【发布时间】:2021-06-05 02:20:30 【问题描述】:我正在使用 Flutter TTS 插件制作一个简单的文本转语音应用程序,并在我的物理 iPhone 和 iPad 上运行它以进行调试。
我尝试用谷歌搜索它,颤振的 github 存储库说我应该运行颤振分析,我这样做了,但它说没有发现任何问题。所以我不确定该怎么做。我认为这是xcode的问题。
这是我的错误:
Failed to build ios app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/flutter_tts-umbrella.h"
^
/Users/ragz/Desktop/Desktop/Development/Projects/flutter/useless_app/ios/Pods/Target Support
Files/flutter_tts/flutter_tts-umbrella.h:13:9: note: in file included from
/Users/ragz/Desktop/Desktop/Development/Projects/flutter/useless_app/ios/Pods/Target Support
Files/flutter_tts/flutter_tts-umbrella.h:13:
#import "FlutterTtsPlugin.h"
^
/Users/ragz/.pub-cache/hosted/pub.dartlang.org/flutter_tts-1.0.0/ios/Classes/FlutterTtsPlugin.h:1:9: error:
'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^
<unknown>:0: error: could not build Objective-C module 'flutter_tts'
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
deployment target versions is 9.0 to 14.4.99. (in target 'flutter_tts' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
Could not build the precompiled application for the device.
Error launching application on iPad.
【问题讨论】:
您是否在 inpo.plist 文件中添加了所需的权限?? 什么意思? 【参考方案1】:- Platform in ios/podfile you can use platform :ios, '10.0'
- If you are changing platform version in podfile than you have to also change version in AppFrameworkInfo.plist.
- Also change version in Deployment Target and Deployment Info of Runner.
- If not working than you have to try with this below commands using for uninstall and install again pods and Run.
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile
flutter run
【讨论】:
【参考方案2】:这里把版本改成9.0就可以了。
【讨论】:
已经是 9.0。还是不行。 试试这个***.com/questions/63973136/…【参考方案3】:您需要通过在 xcode 运行器和目标中更改部署目标将其更改为 9 或我认为 10,还需要在 pod 文件中更改它,通过删除 # 取消注释 #platform :ios, '8.0'
并更改字符串到 10.0。
你也需要改变这个
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target)
进入这个
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'] = '10.0' end end end
在你的 pod 文件的末尾
【讨论】:
【参考方案4】:按照以下步骤操作:
转到 ios/Podfile 并取消注释 platform: ios
参数并替换为
平台:ios,'9.0'
在 ios 文件夹结构中运行以下命令
吊舱安装
运行命令flutter upgrade
运行命令flutter run
【讨论】:
以上是关于如何修复这个 Flutter iOS 构建错误?的主要内容,如果未能解决你的问题,请参考以下文章
Flutter:如何使用 Firebase PhoneNumberAuth 修复丢失与设备的连接错误
尝试运行并构建到 iPhone 模拟器时出现 Flutter Xcode 致命错误
如何修复 Flutter 构建问题期间调用的 setState
构建 Flutter iOS 应用程序时如何解决“格式错误的项目”构建错误
Flutter iOS 应用程序不能为 xcode 模拟器运行 - 如何修复它?
为啥在使用 Flutter 模块构建 iOS 原生应用时修复“Frameworks/Flutter.framework: Permission denied”?