Flutter踩坑之 Could not build the application for the simulatorError launching application on iPhone 11

本文记录了在iOS模拟器上运行Flutter项目时遇到的错误,并提供了详细的解决方案,包括切换Flutter分支和清理项目的方法。

今天在iOS模拟器上运行flutter项目,结果报错如下:

Launching lib/cn/xinzhili/patient/ui/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...
Xcode build done.                                           24.2s
Failed to build iOS app
Error output from Xcode build:** BUILD FAILED **


Xcode's output:=== BUILD TARGET path_provider OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:31: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewController:(SFSafariViewController *)controller
                                  ^
    In module 'SafariServices' imported from /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been marked as being introduced in iOS 9.0 here, but the deployment target is iOS 8.0.0
    @interface SFSafariViewController : UIViewController
               ^
    /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:26:1: note: annotate 'safariViewController:didCompleteInitialLoad:' with an availability attribute to silence this warning
    - (void)safariViewController:(SFSafariViewController *)controller
    ^
    /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:40: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
   
   
                                           ^
    In module 'SafariServices' imported from /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:5:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h:27:12: note: 'SFSafariViewController' has been marked as being introduced in iOS 9.0 here, but the deployment target is iOS 8.0.0
    @interface SFSafariViewController : UIViewController
               ^
    /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:38:1: note: annotate 'safariViewControllerDidFinish:' with an availability attribute to silence this warning
    - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller {
   
   
    ^
                                                                                API_AVAILABLE(ios(9.0))
    /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: warning: 'openURL:options:completionHandler:' is only available on iOS 10.0 or newer [-Wunguarded-availability]
        [application openURL:url
                     ^~~~~~~~~~~
    In module 'UIKit' imported from /Users/hello/Desktop/xzlcorp/AndroidStudioProjects/flutter_app/ios/Pods/Target Support Files/url_launcher/url_launcher-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:130:1: note: 'openURL:options:completionHandler:' has been marked as being introduced in iOS 10.0 here, but the deployment target is iOS 8.0.0
    - (void)openURL:(NSURL*)url options:(NSDictionary<UIApplicationOpenExternalURLOptionsKey, id> *)options completionHandler:(void (^ __nullable)(BOOL success))completion API_AVAILABLE(ios(10.0)) NS_EXTENSION_UNAVAILABLE_IOS("");
    ^
    /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:94:18: note: enclose 'openURL:options:completionHandler:' in an @available check to silence this warning
        [application openURL:url
                     ^~~~~~~~~~~
    /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-4.0.1/ios/Classes/UrlLauncherPlugin.m:122:3: warning: 'SFSafariViewController' is only available on iOS 9.0 or newer [-Wunguarded-availability]
      SFSafariViewController *safari = [[SFSafariViewController alloc] initWithURL:url];
      ^~~~~~~~~~~~~~~~~~~~~~
    In module 'SafariServices' imported from /Users/hello/Desktop/eclipseProject/flutterSdk/flutter/.
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值