Unable to build ios app with --release flag

Hi everybody,
After upgrading Xcode from 11.7 to 12, I encounter a strange problem when trying to build app with this command: ionic cordova build ios --release

Please note that this command works if I have the device attached via USB, also ionic cordova build ios and ionic cordova build ios --prod works aswell. Only --release flag makes the build fail.

This is what console returns:

The following build commands failed:
	Ld /Users/username/Library/Developer/Xcode/DerivedData/APPNAME-ggpsbuijlnzswpeozskwbeikyiev/Build/Intermediates.noindex/APPNAME.build/Release-iphonesimulator/APPNAME.build/Objects-normal/arm64/Binary/APPNAME normal arm64
(1 failure)
xcodebuild: Command failed with exit code 65

–verbose gave this detail:

Error: xcodebuild: Command failed with exit code 65
    at ChildProcess.whenDone (/Users/username/Documents/appname/node_modules/cordova-common/src/superspawn.js:125:23)
    at ChildProcess.emit (events.js:193:13)
    at maybeClose (internal/child_process.js:1001:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)



   Ionic CLI                     : 5.4.4
   Ionic Framework               : @ionic/angular 4.5.0
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.4.1


   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 11 other plugins)


   cordova-res : not installed
   native-run  : not installed


   ios-deploy : 1.9.4
   ios-sim    : 8.0.2
   NodeJS     : v11.13.0 (/Users/username/.nvm/versions/node/v11.13.0/bin/node)
   npm        : 6.7.0
   OS         : macOS Catalina
   Xcode      : Xcode 12.0 Build version 12A7209

Has anyone encountered same problems? Thanks in advance!

1 Like

Same problem here, also after upgrading XCode to version 12, but with an old Ionic v1 project (@ionic/cli v6.11.11; @ionic/v1-toolkit v3.2.14; cordova v9.0.0; NodeJs v12.18.4; Gulp v4.0.2). I’m still trying to find a solution.

[UPDATE] I don’t know if it’s related to this problem but, after playing around with the project for some time, I got a new error:

CordovaError: Promise rejected with non-error: "ios-deploy was not found. Please download, build and install version 1.9.2 or greater from https://github.com/ios-control/ios-deploy into your path, or do ‘npm install -g ios-deploy”.

And, after installing “ios-deploy”, I could run “ionic cordova build ios --release” with no more errors.

Did you find solution? Same problem with xcode 12 ionic 5

I’ve had this several times before - simply unplugging my iPhone from the USB port allowed the build to work.

Sometimes I also had to re-set the signing identity profiles that are selected in Xcode too.

I haven’t found a solution. From now on, I must plug in my iPhone to archive a build, instead of just selecting Any iOS device (Generic device) from the dropdown.

i’m using this command since --release not working
ionic cordova build ios --prod --optimizejs --minifycss --minifyjs

im facing the same exact problem, is there any solution yet, to make the build works with the --release flag

You have to plug in your iOS device and select it in Xcode before running the command.

1 Like

Hi, any news about this problem with XCode 12?
I use OneSignal and receive these errors

ld: in /Users/dave/prj/mobile/myunipa/platforms/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal(OneSignal-arm64-master.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/dave/prj/mobile/myunipa/platforms/ios/Pods/OneSignal/iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/OneSignal'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The following build commands failed:
	Ld /Users/dave/Library/Developer/Xcode/DerivedData/MyUniPa-edohdxillotrtubvlpjnkrqvohyf/Build/Intermediates.noindex/MyUniPa.build/Release-iphonesimulator/MyUniPa.build/Objects-normal/arm64/Binary/MyUniPa normal arm64
(1 failure)
xcodebuild: Command failed with exit code 65

I can’t update the app on App Store