无法使用 Flutter 1.22 在我的 XCODE 12.5.1 上启动我的应用程序

Posted

技术标签:

【中文标题】无法使用 Flutter 1.22 在我的 XCODE 12.5.1 上启动我的应用程序【英文标题】:Can't launch my app on my XCODE 12.5.1, with Flutter 1.22 【发布时间】:2021-09-21 11:19:39 【问题描述】:

我正在处理一个应用程序。在此之前我使用的是另一个版本的 XCode, (我不记得是哪一个了)但最后 ios 模拟器不起作用,我不得不更改为 xCode 12.5.1 的新版本。我的代码使用的是 Flutter 1.22。但是当我尝试启动我的 Xcode 构建时,我遇到了这种类型的错误。

/Users/macbookair/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:343:9: note: did you mean 'tapToDismissEnabled'?
 @param allowTapToDismiss
        ^~~~~~~~~~~~~~~~~
        tapToDismissEnabled
/Users/macbookair/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/UIView+Toast.h:362:20: warning: empty paragraph passed to '@param' command [-Wdocumentation]
 @param queueEnabled
 ~~~~~~~~~~~~~~~~~~^
/Users/macbookair/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:19:23: warning: unused variable 'viewController' [-Wunused-variable]
    UIViewController *viewController =
                      ^
/Users/macbookair/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:70:21: warning: unused variable 'topPadding' [-Wunused-variable]
            CGFloat topPadding = window.safeAreaInsets.top;
                    ^
/Users/macbookair/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:71:21: warning: unused variable 'bottomPadding' [-Wunused-variable]
            CGFloat bottomPadding = window.safeAreaInsets.bottom;
                    ^
/Users/macbookair/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-4.0.1/ios/Classes/FluttertoastPlugin.m:48:19: warning: unused variable 'size' [-Wunused-variable]
        NSNumber *size = call.arguments[@"size"];
                  ^
8 warnings generated.
/Users/macbookair/Desktop/Keatov /App/app/ios/Pods/Reachability/Reachability.m:465:63: warning: cast to smaller integer type 'unsigned int' from 'Reachability *' [-Wpointer-to-int-cast]
                             NSStringFromClass([self class]), (unsigned int) self, [self currentReachabilityFlags]];
                                                              ^~~~~~~~~~~~~~~~~~~
1 warning generated.
/Users/macbookair/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_device_locale-0.4.0/ios/Classes/FlutterDeviceLocalePlugin.m:2:9: fatal error: 'flutter_device_locale/flutter_device_locale-Swift.h' file not found
#import <flutter_device_locale/flutter_device_locale-Swift.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete

无法为模拟器构建应用程序。 在 iPhone 12 Pro Max 上启动应用程序时出错。 退出(sigterm)

【问题讨论】:

【参考方案1】:

错误来自您正在使用的插件之一,“flutter_device_locale”插件

我推荐使用device_info_plus,这也是flutter的最爱, 这是一个链接https://pub.dev/packages/device_info_plus

【讨论】:

谢谢,但我在 pubspec.yaml 文件中没有看到任何名为“flutter_device_locale”的包。如何更改此插件?在哪里?谢谢 这很奇怪,根据您发布的内容,它应该在那里,也许其中一个包取决于它?尝试运行“flutter clean”和“flutter pub cache repair”并重建

以上是关于无法使用 Flutter 1.22 在我的 XCODE 12.5.1 上启动我的应用程序的主要内容,如果未能解决你的问题,请参考以下文章

在我在 Flutter 中打开 Google Photos 之前,Multi Image Picker 无法找到我的图片

无法在 Flutter Web 视图中使用本地存储

在我的应用程序中使用配置文件启用 iCloud

Flutter错误无法启动守护进程

如何在我的Flutter应用中集成游戏?

Mac Flutter 安装:无法访问锁定文件