Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 8.3 Swift Version Error (SWIFT_VERSION) In Objective C Project

I have been getting the following error with Xcode 8.3 in my pure Objective C project.

I have not been able to find a solution for this, there are no swift parameters in my build settings and I can not find any solutions online for this either.

Any Ideas? This was building fine a few days ago, and the only difference I can see is that xcode updated.

"Swift Language Version" (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

like image 855
Rob Avatar asked Apr 05 '17 19:04

Rob


2 Answers

So the answer to this is to go to the build settings and click the + icon at the top left (as per screen shot below). Then choose to add a User Defined parameter with SWIFT_VERSION and a value of 3.0. Build the app and it should run fine.

enter image description here

I also added the following to my Pod file too to automatically do the same process for the pod dependency build settings, although this alone did not resolve the problem:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '3.0'
        end
    end
end
like image 119
Rob Avatar answered Nov 16 '22 02:11

Rob


Click On Pods Project under Project Navigitor, and go to build settings search for swift_version then change swift language version to Swift 4.0

Pods>BuildSettings>Swift Language Version>Swift 4.0

enter image description here

like image 41
Smart guy Avatar answered Nov 16 '22 01:11

Smart guy