15

After upgrading to xcode 10.2 my ionic for ios project stopped building using below command

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

i tried to upgrade [email protected] and remove and readd ios platform but no luck.

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 4.0, 4.2, 5.0. This setting can be set in the build settings editor.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 12.2'

** ARCHIVE FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.

        cordova build ios --buildFlag=-UseModernBuildSystem=0 exited with exit code 65.

        Re-running this command with the --verbose flag may provide more information.
6
  • So I tried to convert the project from Swift 3 to Swift 4.2 using Xcode 10.1. However, some of the plugins broke. Then I tried to fix, but it ended a big mess. So I just ended up using Xcode 10.1 for development for now. You can download Xcode 10.1 https://developer.apple.com/download/more/
    – Bao Pham
    Commented Mar 29, 2019 at 21:33
  • 2
    Xcode 10.1 doesn't run application on iPhone with iOS 12.2. So it's a big issue, now we can only run apps on simulator. It would be nice to have a proper solution. Commented Apr 9, 2019 at 19:24
  • @BaoPham Yes - but in my case when the user upgrades to iOS 12.2 on their iPad the app still won't run. Commented Apr 23, 2019 at 17:20
  • @P.Brian.Mackey I think the ionic team has updated their Swift code. Check again.
    – Bao Pham
    Commented May 3, 2019 at 18:41
  • 1
    @P.Brian.Mackey have you tried install this? https://www.npmjs.com/package/cordova-plugin-add-swift-support and add <preference name="UseSwiftLanguageVersion" value="5" /> into config.js?
    – Bao Pham
    Commented May 4, 2019 at 4:30

3 Answers 3

2

I ran into the same error. I first tried to switch the Swift Language version in the Xcode build setting and quickly realized that some plugins written in Swift broke. Thankfully the plugin which broke for me was QR Scanner which is well maintained and has been updated for Swift 5.

So what I did to fix it was first run the following node commands to find and update the outdated node packages.

npm outdated
npm update

Then I identified the outdated/broken cordova plugins, removed them, then reinstalled the latest versions. Using

cordova plugin list

to make sure everything was updating correctly, cross referencing with the version numbers with the plugins repo. Then finally I added this to the config.xml

<preference name="UseSwiftLanguageVersion" value="5" />

and everything built successfully when running,

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

Unfortunately, if you're using a cordova plugin that is written in Swift and is not well maintained you're out of luck. You can try to update the plugin yourself if you're brave.

Hopefully this was helpful and doesn't require you to role back your Xcode, losing the ability to build for the latest version of iOs.

2

You should go with below steps-

  1. Open your project in Xcode by click on workspace file in platforms >> ios >> PROJECT_NAME.xcworkspace

  2. Go for Build Settings

  3. Now search "Swift Language Version"

  4. Change the version to 4 or 5(whichever required)

  5. run below command

    Ionic cordova build ios --buildFlag="-UseModernBuildSystem=0"

2

Just add this plugin

cordova plugin add cordova-plugin-add-swift-support --save

Or if you already added then just remove this plugin and add again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.