How to build Ionic Cordova with Xcode 10?


#1

Cordova problem and workaround : https://github.com/apache/cordova-ios/issues/407

But how to do that with ionic ?

Thanks.


#2

I would try:

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

Does one of those work?


#3

Thank you, it works.


#4

Thanks a lot. First one worked. I didn’t have to try the second. Thanks fella :slight_smile:


#5

Thanks alot. the first command works. If you dont mind can you please explain what the issue is?


#6

Xcode comes with a new build system by default.
Cordova iOS doesn’t support it yet.


#7

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


#8

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

#9

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.


#10

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'"


#11

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


#12

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).


#13

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"
            ]
        }
    }
}

Exception with livereload when using flag "UseModernBuildSystem"
#14

thanks man. thanks a lot


#15

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


#16

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


#17

It works beautifully. Thanks @MattE.


#18

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


#19

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