user12219021
user12219021

Reputation:

Flutter : Failed to build iOS app "ARCHIVE FAILED",Encountered error while archiving for device

I was trying to generate the ipa file to upload it on App Store but unfortunately it failed and says "Encountered error while archiving for device". I also tried Archiving from Xcode but, the Archive failed there too. It is working great in ios simulator (13)

Failed to build iOS app Error output from Xcode build: ↳ ** ARCHIVE FAILED **

Xcode's output: Writing result bundle at path:

    /var/folders/8s/2st2j0d97k7cm80h3968jnx80000gn/T/flutter_tools.ph1v
            kd/flutter_ios_build_temp_dirZbRdRw/temporary_xcresult_bundle
    
        error: the following command failed with exit code 0 but produced no
        further output
        CompileC
        
Failed to package /Users/sunsoft/Downloads/alifpet-app-master.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:
    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 15.2.99. (in target 'Sodium' from project 'Pods')
    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:
    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 15.2.99. (in target 'ReachabilitySwift' from project 'Pods')
    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:
    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 15.2.99. (in target 'Starscream' from project 'Pods')
    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is
    set to 6.0, but the range of supported deployment target versions is
    9.0 to 15.2.99. (in target 'Reachability' from project 'Pods')
    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is
    set to 7.0, but the range of supported deployment target versions is
    9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')
    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:
    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 15.2.99. (in target 'PusherSwiftWithEncryption' from project
    'Pods')
    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:
    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 15.2.99. (in target 'GoogleSignIn' from project 'Pods')
    /Users/sunsoft/Downloads/alifpet-app-master/ios/Pods/Pods.xcodeproj:
    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 15.2.99. (in target 'AgoraRtcEngine_iOS' from project 'Pods')

    Result bundle written to path:
        /var/folders/8s/2st2j0d97k7cm80h3968jnx80000gn/T/flutter_tools.ph1v
        kd/flutter_ios_build_temp_dirZbRdRw/temporary_xcresult_bundle
    
    Encountered error while archiving for device.

Upvotes: 7

Views: 17693

Answers (2)

Graphite
Graphite

Reputation: 387

My situation is a bit different, I even cannot build it, the error message was "PhaseScriptExecution failed with a nonzero exit code" while I built it using Xcode so I follow @Taimoor Sikander solution from https://stackoverflow.com/a/75976213/1603455

Then flutter build ipa on VSCode terminal that went successfully. Hope that helps.

Upvotes: 0

Vandad Nahavandipoor
Vandad Nahavandipoor

Reputation: 1574

The problem here is that the Podfile that Flutter template creates by default has no specific iOS version set unfortunately.

Do this to fix this problem:

  1. in ios/ folder of your project, open the Podfile.
  2. At top of Podfile, make sure this line is not commented out and change the iOS version to 12.0.

change from:

#platform :ios, '8.0'

to:

platform :ios, '12.0'
  1. Run pod deintegrate in Terminal inside the ios/ folder of your project.

  2. Run pod install --repo-update in your ios/ folder

This should do the trick!

If after this you are getting the following error

CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target

Then you need to open your iOS workspace in Xcode and select your root project on top left, then inside the Info tab, choose your configuration (in this case Debug) and change it to None. After that, do pod install again.

enter image description here

Upvotes: 10

Related Questions