尝试运行或构建iOS的Flutter项目时出错

时间:2020-10-07 19:15:18

标签: flutter flutter-dependencies

所以基本上我可以运行其他项目,并且可以为Android运行该项目,但是当我想为iOS运行或构建它时,会收到以下错误消息。也不是与项目相关的问题,我的同事可以很好地运行它。我尝试了所有可能的在线解决方案,将安装后的内容添加到Podfile中,尝试在Xcode中更改为“旧版构建系统”,但存在相同的错误,尝试重新安装Pod,CocoaPods,甚至切换到Beta版。不知道该怎么办。

Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
 
Running pod install...                                             23.5s
Running Xcode build...                                                  
Xcode build done.                                           28.5s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/djordje/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.1+1/ios/Classes/strategies/PhotoPermissionStrategy.m:39:13:
    warning: enumeration value 'PHAuthorizationStatusLimited' not handled in switch [-Wswitch]
        switch (authorizationStatus) {
                ^
    /Users/djordje/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.1+1/ios/Classes/strategies/PhotoPermissionStrategy.m:39:13:
    note: add missing switch cases
        switch (authorizationStatus) {
                ^
    1 warning generated.
    /Users/djordje/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_downloader-0.19.2/ios/Classes/SwiftImageDownloaderPlugin.swift:37:17: error:
    switch must be exhaustive
                    switch status {
                    ^
    /Users/djordje/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_downloader-0.19.2/ios/Classes/SwiftImageDownloaderPlugin.swift:37:17: note: do
    you want to add missing cases?
                    switch status {
                    ^
    /Users/djordje/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.m:45:52:
    warning: assigning to 'id<IAPPromotionObserverDelegate>' from incompatible type 'FlutterInappPurchasePlugin *__strong'
        [IAPPromotionObserver sharedObserver].delegate = self;
                                                       ^ ~~~~
    /Users/djordje/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.m:200:79:
    warning: implicit conversion loses integer precision: 'SKPaymentTransactionState' (aka 'enum SKPaymentTransactionState') to 'int' [-Wshorten-64-to-32]
                                                         [NSNumber numberWithInt: item.transactionState], @"transactionStateIOS",
                                                         ~                        ^~~~~~~~~~~~~~~~~~~~~
    /Users/djordje/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.m:586:71:
    warning: implicit conversion loses integer precision: 'SKPaymentTransactionState' (aka 'enum SKPaymentTransactionState') to 'int' [-Wshorten-64-to-32]
                                                 [NSNumber numberWithInt: transaction.transactionState], @"transactionStateIOS",
                                                 ~                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3 warnings generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'abseil' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'image_downloader' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'gRPC-C++' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'gRPC-Core' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'Protobuf' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'PromisesObjC' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'GoogleUtilities' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'GoogleDataTransport' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'GTMSessionFetcher' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'GTMAppAuth' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseMessaging' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseStorage' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseInstanceID' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseInstallations' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseFirestore' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseDynamicLinks' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseCore' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseAuth' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseCoreDiagnostics' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'BoringSSL-GRPC' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FBSDKLoginKit' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'AppAuth' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'path_provider' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'package_info' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'scrollable_bottom_sheet' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'permission_handler' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'url_launcher' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'shared_preferences' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'nanopb' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'map_launcher' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'location_permissions' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'location' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'maps_launcher' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'leveldb-library' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'google_sign_in' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'image_picker' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'google_maps_flutter' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'geolocator' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'geocoder' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'flutter_inapp_purchase' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'flutter_email_sender' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'flutter_appavailability' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'firebase_storage' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'firebase_messaging' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'firebase_dynamic_links' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'firebase_auth' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'firebase_core' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'device_info' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'contacts_service' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'cloud_firestore' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'apple_sign_in' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FBSDKCoreKit' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'GoogleAppMeasurement' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'GoogleSignIn' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'FirebaseAnalytics' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'Flutter' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.0.99. (in target 'Firebase' from project 'Pods')

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.

1 个答案:

答案 0 :(得分:0)

Flutter project - XCode build failed有关

首先确认你在flutter channel中是稳定的,然后flutter升级

然后,什么对我有用:

sudo gem uninstall cocoapods; 
sudo gem install cocoapods; 
flutter clean
flutter pub get
cd ios; pod install; cd ..;

其他可能有用的命令

cd ios; pod install --repo-update; cd ..;
//deactivate rvm
rvm use system

其他想法:

  • 删除整个 repo 和 git clone
  • 删除派生数据(检查谷歌)
  • 删除 Podspec.lock 和 Gemfile.lock