57

Flutter version is 2.2.3 and I cant't run de flutter code on my iOS emulator.

Launching lib/main.dart on iPhone 13 Pro in debug mode...
lib/main.dart:1
Xcode build done.                                           43.6s
Failed to build iOS app
Error output from Xcode build:
↳
    --- xcodebuild: WARNING: Using the first of multiple matching destinations:
    { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
    { platform:iOS Simulator, id:320795B7-1385-4044-B442-87A9808936D9, OS:15.0, name:iPhone 13 Pro }
    { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
    { platform:iOS, id:00008101-000825EC3AE1001E, name:leobidoous iPhone, error:Device is busy (Making leobidoous iPhone ready for development, Processing cache files from device, Making the device ready for development) }
    ** BUILD FAILED **
Xcode's output:
↳
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in parallel
leobidoous
  • 571
  • 1
  • 4
  • 3

15 Answers15

19

I had the same problem updating Xcode. Solve just logging back into Xcode.

  1. Open Xcode
  2. Open the project's Runner.xcworkspace file
  3. Log into Xcode at: "Signing & Capabilities" -> "All" -> "Signing"

Item 3 was my problem. When updating Xcode, I was logged out.

EderBaum
  • 993
  • 13
  • 16
13

Adding these lines to Podfile Helped me.

target.build_configurations.each do |build_configuration|
    build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end

Example: enter image description here

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Athul A
  • 157
  • 7
5

put this code in your Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |build_configuration|
        build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
    end
  end
end
宋庞玉
  • 51
  • 1
  • 2
4

If you use package sign_in_with_apple, it should have 3.2.0 version at least.

Danil
  • 41
  • 3
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 18 '21 at 13:45
  • This solution helped me too. But maybe just removing cache about sign_in_with_apple packge and let flutter pub and cocoapods gets it again would be a solution too. Note that, i didn't try it. – code8x Nov 16 '21 at 14:09
3

The only solution that worked for me was to completely remove the xcode installed and reinstall from the app store.

When removing the old xcode, make sure to remove all the residual files - especially the developer folder. Try these following commands

sudo rm -rf ~/Library/Developer/
sudo rm -rf ~/Library/Caches/com.apple.dt.Xcode

and remove xcode from Application to bin. Doing this will completely clean the xcode residuals and then you can reinstall from the appstore.

ouflak
  • 2,458
  • 10
  • 44
  • 49
2

I encountered same issue and by running flutter clean fixed the issue for me.

Also try restarting the IDE if this doesn't work.

Basil Mariano
  • 2,437
  • 1
  • 20
  • 13
1

For me, I am fine after forcing the Simulator.app quit and run the command again.

Horst
  • 1,733
  • 15
  • 20
0

I faced the same issue for flutter version 2.5.1 stable Previously i installed flutter using Zip archive file now I completely removed that installation and setup it using Git clone screenshot from flutter doc

I did things like flutter clean, pod clear cache , pod install etc IMP Note in xcode please check developer signing&capabilities options for runner etc I did these and these are worked for me

Ashok Chowdary
  • 101
  • 1
  • 7
0

The relevant part here is

Command PhaseScriptExecution failed with a nonzero exit code

which means that any of the scripts configured in Xcode > Targets > Runner > (Tab) Build Phases failed. The problem here is that you do not see the error message (which script failed and why).

Add the --verbose flag (short: -v) to the flutter run command:

flutter run -v

This will output a lot. At the end you need to scroll a bit up to the the actual script error.

Once you know the actual error, you probably can solve it easily or open a new and more specific question.

Stuck
  • 11,225
  • 11
  • 59
  • 104
0

I encountered the same error on flutter 2.5.3. Now I downgraded to 2.5.1 and the app is running on my iOS emulator. Try this may help you.

ouflak
  • 2,458
  • 10
  • 44
  • 49
Akil S
  • 21
  • 4
0

I have solved it by clean the IDEA + flutter clean then restarting Mac then open Xcode from flutter project then clean Xcode build by select product -> Celan Build folder then RUN your project from Xcode to download dependence

YahYa
  • 407
  • 4
  • 9
0

Add the below lines to your podfile. Place the below lines in the post_install do [installer] section at the bottom of the Podfile.

Code :

target.build_configurations.each do |build_configuration|
  build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
end
0

All of the answers here, depending on your circumstances, have aspects that absolutely remove this error. For myself, what I can say is that I can confirm that using an 2021 M1 macbook pro max with a fresh set of tools, flutter 2.8.1, dart 1.15.1 and having the following or similar post_install section in my podfile also silenced the offending output.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
    end
  end
end
0

Try this. This process will re-download ios and android development tools again after running the code through the ios and android simulator. Worked for me

Flutter clean

Flutter get

Flutter channel stable

flutter upgrade

and restart IDE as well as close Xcode. works for me, I hope this helps

0

If your project is with firebase and it is cloned and cleaning is not well like me. Probably this can help you.

  1. Add GoogleService-Info.plist back to your Runner project. (if already have can ignore)
  2. Try to Clean Build Folder on xcode then Build again.
  3. Try to build into Simulator using xcode.
  4. Try to build into your connected iPhone.
  5. If 3 and 4 is working. Back to your vscode then build and run again to iPhone or Simulator
FeelRightz
  • 2,777
  • 2
  • 38
  • 73