How to build Ionic Cordova with Xcode 10?

… read more at the link @Borongaj included in the initial post: https://github.com/apache/cordova-ios/issues/407

1 Like

For some reason, I have this error when executing the command.
Even copying the command results in this error, so it isn’t due to typing errors.

Ionic info:

Ionic:

   ionic (Ionic CLI)          : 4.1.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.11
   @angular-devkit/core       : 0.8.3
   @angular-devkit/schematics : 0.8.3
   @angular/cli               : 6.2.3
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.6

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.1, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.0, (and 7 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/Matt/Library/Android/sdk)
   ios-deploy        : 1.9.2
   ios-sim           : 6.1.2
   NodeJS            : v8.11.3 (/usr/local/bin/node)
   npm               : 5.6.0
   OS                : macOS High Sierra
   Xcode             : Xcode 10.0 Build version 10A255

Get rid of the ionic in front and one of the -- inside the command - that might work. Seems Ionic CLI does some filtering of available parameters to Cordova and the required one is missing.

That kind of works, but doesn’t compile the ionic project before building it with Cordova.
Using this npm script, I seperate the 2 pieces and this works, but it doesn’t feel like the best solution.

"ios-build": "ng run app:ionic-cordova-build:production --platform=ios && cordova build ios --buildFlag='-UseModernBuildSystem=0'"

Have you try to finish your build in Xcode? Like doing a normal build ionic cordova build iOS --prod and then do the rest of the job in Xcode

but to do so, you would adjust the workspace in Xcode as described in the last post of https://github.com/apache/cordova-ios/issues/412

If you open the resulting project in Xcode, it will by default try to use the new build system. You must update the workspace settings in the Xcode IDE and set the Build System to Legacy before making any builds through the Xcode IDE.

At least for me, using the above cmd and doing the rest of the job in Xcode 10 after I had accepted to change proposed by Xcode to my workspace works fine

I hope it can help

Yes, you should probably report this in the Ionic CLI repository (or see if there maybe already is a newer version of the CLI you can update to).

For the record: adding a build.json to the root of the project is the easier solution.
With this file it isn’t necesary anymore to do some magic with commands and you can continue to use the normal Ionic CLI commands.

build.json:

{
    "ios": {
        "debug": {
            "buildFlag": [
                "-UseModernBuildSystem=0"
            ]
        },
        "release": {
            "buildFlag": [
                "-UseModernBuildSystem=0"
            ]
        }
    }
}
13 Likes

thanks man. thanks a lot

Has anyone gotten

ionic cordova run ios

to work? Adding the build.json fixed building, but when I try to run, I get this error:

(lldb) command script import "/tmp/7565474C-7EF1-488C-BD16-063EAED02E52/fruitstrap_00008020-001654991178002E.py" error: module importing failed: ('invalid syntax', ('temp.py', 1, 27, 'import fruitstrap_00008020-001654991178002E\n')) backtrace unavailable

A post was split to a new topic: Code Signing Error: No profiles for ‘com.oas.MyJiranV1’ were found:

It works beautifully. Thanks @MattE.

The Cordova team is investigating adding support for Xcode 10 builds for cordova-ios v5.0.0. The Ionic team is also investigating adding Xcode 10 support to Ionic Pro Package. At the moment, if you wish to build your Ionic app(s) locally using Xcode 10, you can use the following CLI command to run your build.

ionic cordova build ios – --buildFlag="-UseModernBuildSystem=0"

// Alternatively, running your application

ionic cordova run ios – --buildFlag="-UseModernBuildSystem=0"

Best Regards,
Balu voip phone intercom

do you know how to build with a --prod flag I noticed with this build setting App is loading very slow

Use this and free from errors
But check whether iOS-deploy is installed or not, so use

npm install ios-deploy
and then next command:

ionic cordova build ios – --buildFlag=“-UseModernBuildSystem=0”

cordova-ios@5.0.0 now supports Xcode 10 https://cordova.apache.org/announcements/2019/02/09/cordova-ios-release-5.0.0.html

So you no longer need the flag -- --buildFlag="-UseModernBuildSystem=0" :slight_smile:

Just do the following:

ionic cordova platform remove ios
ionic cordova platform add ios@5.0.0
6 Likes

Hi,

I am facing this same issue.

I am working on Ionic 1 app.
I am able to build .apk for latest version android phones and app is working fine.
With following command:
ionic cordova run ios – --buildFlag="-UseModernBuildSystem=0"
I am able to build iOS project from ionic and able to generate ipa file from xcode 10. But after installing .ipa on actual device (with iOS 12 and above), app open for a second and went into background.
Same .ipa file is working fine for older iOS devices with iOS 9 and 10.

Following are my setup details:

Ionic:

ionic (Ionic CLI) : 4.9.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic1 1.3.3
@ionic/v1-toolkit : 1.0.17

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, ios 5.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 19 other plugins)

System:

ios-deploy : 1.9.2
ios-sim : 7.0.0
NodeJS : v10.15.0 (/usr/local/bin/node)
npm : 6.8.0
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61

Kindly advise.

Hi All,

I found the resolution for this issue.
It seems the issue was with CT signature issue.

Posting the resolution, so it might help someone.
In Keychain Access, I set the trust settings to “Use System Defaults” for the following certificates:

Apple Worldwide Developer Relations Certification Authority
Developer ID Certification Authority
iPhone Developer: {email}
iOS Distribution

After this, in XCode do clean build for the project. Also restart XCode.

I have an Ionic 3 App using Enterprise Distribution for a client and of course Apple likes to change settings on their new iOS. Everything was working fine on iOS 11 and when a client-user upgraded to iOS 12 their app completely broke and could not re-download.

Steps I’ve Tried:

  • Check iOS Provisioning Profile Status
  • Rebuild App in Xcode 10.0
  • Archive and create new manifest and .ipa file for app
  • Rebuild app in npm using ionic cordova build ios --prod
  • Update any plugins that we’re needing updates using npm outdated
  • Commit and Push to Production branch using ionic Deploy

Everything I’ve tried allowed me to build the app successfully and I was able to build the app locally on my device via Xcode, but as soon as I put the .ipa file on our server the app will not successfully download.

I have a feeling it may be a particular setting in Xcode, but I’m stuck right now. Any help would be appreciated.

Edit: After the update of Xcode 10, the app would no longer build successfully after running ionic cordova build ios

Have you checked File > Workspace Settings > Build System from Xcode ?