error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'Starscream')

落爺英雄遲暮 提交于 2021-02-10 14:35:24

问题


Steps to recreate

$ vue init nativescript-vue/vue-cli-template transport
$ cd transport
$ npm install
$ tns run ios --bundle

Log error:

error: SWIFT_VERSION '5.0' is unsupported, supported versions are: 3.0, 4.0, 4.2. (in target 'Starscream')
note: Using new build systemnote: Planning buildnote: Constructing build description
** ARCHIVE FAILED **

Mac OS High Sierra 10.13.6 Darwin Aerosol.local 17.7.0 Darwin Kernel Version 17.7.0: Wed Feb 27 00:43:23 PST 2019; root:xnu-4570.71.35~1/RELEASE_X86_64 x86_64

node -v v11.7.0 npm -v 6.9.0 vue -v 3.6.3

I was able to create new apps and run them on my iOS devices but for some reason things have changed last 1-2 week. It looks like I can not develop NativeScript apps anymore. Any hints?


回答1:


if you have problems with SWIFT_VERSION on the build you can configure manually it adding a PodFile to your project (App_Resources/iOS) setting the version you want, something like this in the PodFile should solve your problem

pre_install 
do |installer|
    installer.analysis_result.specifications.each 
    do |s|
        if s.name == 'Starscream'
            s.swift_version = '4.2'
        end
    end
end

I wish this can help you

Sorry man, I make a mistake in... this is the correct PodFile

pre_install do |installer|
    installer.analysis_result.specifications.each do |s|
        if s.name == 'Starscream'
            s.swift_version = '4.2'
        end
    end
end



回答2:


The last time I had issues with Swift versions an Pods, downgrading cocoapodsfrom 1.6.x to 1.5 resolved the issue:

    sudo gem uninstall cocoapods
    sudo gem install cocoapods -v 1.5.3

Looking at the release notes for cocoapods1.6 back in march showed some changes regarding this.

The error messages were different, though but it might be worth a try.




回答3:


I just realized that I do not have to start native app creation using vue init, ie

$ vue init nativescript-vue/vue-cli-template transport

but with tns create there is no problem at all, I can choose Vuejs without downloading template via vue

$ tns create myapp



回答4:


I performed a very simple solution and it worked like wonder.

  1. Click on the project you intend to build under Project Navigator.
  2. Click on Build Settings -> Combined in General Setting pane.
  3. Change to the desired version from drop down under 'Swift Language Version'
  4. Build the project again. Voila !!!

Screen shot of the image



来源:https://stackoverflow.com/questions/56432520/error-swift-version-5-0-is-unsupported-supported-versions-are-3-0-4-0-4-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!