3

The fight with the following error after pod spec lint BSTableViewReorder.podspec --verbose:

=== CLEAN TARGET BSTableViewReorder OF PROJECT Pods WITH CONFIGURATION Release ===

Check dependencies
“Use Legacy 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.
“Use Legacy 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.

** CLEAN FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
=== BUILD TARGET BSTableViewReorder OF PROJECT Pods WITH CONFIGURATION Release ===

Check dependencies
“Use Legacy 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.
“Use Legacy 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.

** BUILD FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
 -> BSTableViewReorder (1.4.3)
    - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error.

Any ideas how to workaround this?

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

2 Answers2

1

Update on 2016-Oct-22

I've installed CocoaPods 1.1.1 and found the advice below to work without need for installing a prerelease version. In other words, the changes for explicitly setting the Swift version are now merged with the release version of CP.


The answer is to explicitly handle the Swift version for the framework that you are building during the pod spec lint.

If your source is using Swift 3.0 then here is the solution. If your source is using Swift 2.3 then you can probably resolve the error by just building the latest CocoaPods from its GitHub repository. See my answer for that further down.


The solution is to add a text file named .swift-version to your metadata folder containing your podspec.

The contents of the file should be the following.

--- START OF FILE ---
3.0

--- END OF FILE ---

For the related source code changes, see Merge of PR #5841 in the CocoaPods repository.


I built CocoaPods from source to get this to work. I used the following commands.

$ git clone git@github.com:CocoaPods/CocoaPods.git
$ bundle install

Support for .swift-version is not yet available in the latest prelease version 1.1.0.rc.1 as far as I know.

Daniel Zhang
  • 5,778
  • 2
  • 23
  • 28
0

Did you try "Edit > Convert > To Current Swift Syntax…" as the message implies?

ThorstenC
  • 1,264
  • 11
  • 26