How to fix “SWIFT_VERSION '3.0' is unsuppo

2020-01-27 14:07发布

I'm trying to run downloaded from app, try to open in Xcode and have an error:

" Showing Recent Messages
:-1: SWIFT_VERSION '3.0' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'SimpleWeather')"

Screenshot added

11条回答
Luminary・发光体
2楼-- · 2020-01-27 14:40
  1. Check this out:
    1. Click on Project name
    2. Click target
    3. Click on Build setting
    4. At the Swift Language Version: Choose Swift 4

enter image description here

enter image description here

查看更多
forever°为你锁心
3楼-- · 2020-01-27 14:40

1) change pod's version on podfile (because library wrote old swift version )

2) "pod install" on terminal

查看更多
该账号已被封号
4楼-- · 2020-01-27 14:41

Select the target 'SimpleWeather' in the project and change language version Target->build setting -> Swift compiler language -> select 5, 4.2 etc

image of build setting for changing compiler language

查看更多
手持菜刀,她持情操
5楼-- · 2020-01-27 14:48

It seems that the app might have an old Swift version code like Swift 3.0 in your case. In the release of Xcode version 10.2 has launched Swift 5.0 version. Xcode 10.2 does not support compiler for Swift 3.0 version. You can change compiler from Build Settings -> Swift Compiler - Language -> Swift Language Version -> Change it to Swift 5. If your code is compatible with that language version then it will run the code without error.

However, the Swift 3 compatibility mode will not be supported in the Swift 5 compiler. Swift 4.2 is the last release of Swift to support Swift 3 mode. There are important changes to both the surface of the language and the interior of its implementation in the releases following Swift 3 that will be the basis of future (and lasting) source and binary stability.

Refer below link for more details. https://developer.apple.com/documentation/xcode_release_notes/xcode_10_2_release_notes/swift_5_release_notes_for_xcode_10_2

If you really wish to run the app which has older Swift version code than you must have to use an older version of Xcode. You can use Xcode version 10.1, it's compiler having support for Swift 3.0 version.

Another alternative way is to migrate your old Swift code to the new version of the Swift version. You can migrate you Swift 3.0 to Swift 4.0 in Xcode 10.1 version.

For migration guide refer to this https://swift.org/migration-guide-swift4/

查看更多
聊天终结者
6楼-- · 2020-01-27 14:54

I am new to iOS development. After I followed all of the above answers, I still got the same error. I was using Xcode 11 and I downloaded the "FoodTracker" sample from Apple Developer web site and I got the same error after trying to build it. I found that the project has several settings referring to Swift language version after VIM the project file content. So, I resolved this by first setting the "Project > FoodTracker", and also "TARGETS > FoodTracker" and "TARGETS > FoodTrackerTests" the Swift Language Version to 5.0. Hope it helps.

Setting Swift Language Version on Project and ALL Targets

查看更多
登录 后发表回答