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 cordova-ios@5.0.0 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.
Moblize IT
  • 1,140
  • 2
  • 18
  • 44
  • 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 Mar 29 '19 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. – Andrey Klochkov Apr 09 '19 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. – P.Brian.Mackey Apr 23 '19 at 17:20
  • @P.Brian.Mackey I think the ionic team has updated their Swift code. Check again. – Bao Pham May 03 '19 at 18:41
  • I ended up just opening up XCode and setting Swift to v4.0 in the build settings. Problem gone. – P.Brian.Mackey May 03 '19 at 22:39
  • 1
    @P.Brian.Mackey have you tried install this? `https://www.npmjs.com/package/cordova-plugin-add-swift-support` and add `` into `config.js`? – Bao Pham May 04 '19 at 04:30

3 Answers3

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.

cdubs
  • 21
  • 4
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"

Kshitij
  • 360
  • 4
  • 12
1

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.

kunal shaktawat
  • 1,428
  • 12
  • 21