meltonCG
meltonCG

Reputation: 119

The “Swift Language Version” (SWIFT_VERSION) build setting error with project in Objective C

So i just went to build my app after adding in core data to update my app to store and fetch some information and i got this error. (I am using XCode 9.2)

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

Now whats confusing me is this in an Objective C app and surely the swift version shouldn't matter. I have browsed some threads on here stating that i need to update build setting to Swift 3.0 or to set values to Yes then back to No, however i have none of these fields when i search for Swift in the search bar.

buildSettings

Is this just a bizarre bug or have i mistakenly added some swift code?

Any ideas would help, thanks.

Upvotes: 4

Views: 6061

Answers (2)

cmlloyd
cmlloyd

Reputation: 975

I experienced this exact same issue after adding Core Data to an Objective-C framework I was working on.

I discovered that the reason I was getting the "Swift Language Version" warning was that the Code Generation language in the .xcdatamodel defaulted to Swift. Once I changed this back to Objective-C, the warning went away.

You can find this property in the File Inspector when you have the .xcdatamodel selected in the Project Navigator.

enter image description here

Upvotes: 6

meltonCG
meltonCG

Reputation: 119

For Objective C Projects created using Xcode 8 and now opening in Xcode 9, it is showing the same error as mentioned in the question.

To fix that, Press the + button in Build Settings and select Add User-Defined Setting.

Then in the new row created add SWIFT_VERSION as key and 3.2 as value like below.

It will fix the error for objective c projects.

Upvotes: 4

Related Questions