flutterdartflutter2.0

Flutter give me CompileSwift failed with a nonzero exit code


I have updated a flutter app to Flutter version 2.2.1 • channel stable, but when it runs the flutter run on ios devices I get the following errors, what is this due to? how can i fix it? i read online and several people have these problems, the error shows up after the flutter update but since I have to use the latest version of flutter I have to find a way to fix the errors, how do I fix this?

Error at flutter run:

Error output from Xcode build:
↳
    objc[69849]: Class AMSupportURLConnectionDelegate is implemented in both ??
    (0x1f9b08188) and ?? (0x1166cc2b8). One of the two will be used. Which one is
    undefined.
    objc[69849]: Class AMSupportURLSession is implemented in both ?? (0x1f9b081d8) and ??
    (0x1166cc308). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **

Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    In file included from
    /Users/utente/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.4.3/ios/Class
    es/SharedPreferencesPlugin.m:5:
    /Users/utente/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.4.3/ios/Class
    es/SharedPreferencesPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/utente/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.4.3/ios/Class
    es/SharedPreferencesPlugin.m:5:
    /Users/utente/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.4.3/ios/Class
    es/SharedPreferencesPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.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
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'shared_preferences' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'printing' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'mp3_meta_data' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'location' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'image_cropper' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'google_maps_flutter' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'flutter_local_notifications' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'barcode_scan' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'package_info' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'advance_pdf_viewer' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'flutter_image_media' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'sqflite' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'path_provider' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'image_picker' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'flutter_email_sender' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'TOCropViewController' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'MTBBarcodeScanner' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'FMDB' from project 'Pods')
    /Users/utente/Desktop/Progetti/Gitlab/appflutter/quote/ios/Pods/Pods.xcodeproj:
    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.5.99. (in
    target 'Flutter' from project 'Pods')

Solution

  • In my case running the following helped me

    $ flutter clean && flutter create .