Ionic make archive instead build

I have a project which is being developed with other developer. A couple of days ago, after git pull, make some changes and I typed ‘ionic build ios’, as many times before.
And I get error ** ARCHIVE FAILED **. (Android works)

What happened is not clear. But I found that this happens with new projects too.
For example, create new project:

‘ionic start testState blank’
‘ionic build ios’
** BUILD SUCCEEDED **

But, if you did
‘ionic state reset’ or ‘ionic state clear’ and try build
you get something like this:
Error: Source path does not exist: resources/ios/icon/icon-40@3x.png

'ionic resources'
and again
'ionic build ios'

and now you get:
** ARCHIVE FAILED **

The following build commands failed:
	Check dependencies
(1 failure)

Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Trazius/WebstormProjects/testState/platforms/ios/cordova/build-debug.xcconfig,-workspace,testState.xcworkspace,-scheme,testState,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,testState.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/Trazius/WebstormProjects/testState/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/Trazius/WebstormProjects/testState/platforms/ios/build/sharedpch

Sometimes, if you make some changes in project, you can get:
** ARCHIVE SUCCEEDED **

Exported testState App.xcarchive to: /Users/Trazius/WebstormProjects/testState/platforms/ios/build/device

** EXPORT SUCCEEDED **

I didn’t see this trouble earlier, how I can return normal build from project?

1 Like

After trying tons of things this is what I had to do to get things back to normal:

  • Globally unistall ionic and cordova
  • Delete git repo locally and re-clone
  • Run npm install
  • cordova platform add ios
  • manually add all plugins (found in package.json)
  • cordova plugin add cordova-plugin-x
  • ionic build ios is now behaving as expected.

This was a nightmare and I will never use ionic state X again :frowning:

1 Like

Hello !
I tried what you said and it worked for 3 builds then Ionic started archiving my project again …
Do you have another solution ? Do you know why Ionic have this behavour ?

EDIT :
I noticed that Ionic built correctly the app when my phone wasn’t plug.
I have to add the option --emulator to get ionic build to build correctly (ionic build --emulator ios)

1 Like

For me building also only works if the device is not plugged. Otherwise it will archive. Did you find a solution to this?

Use the flag --emulator :slight_smile:

2 Likes
ionic build ios --emulator

Works fine for me :slight_smile:

1 Like