Recusiwe
Recusiwe

Reputation: 898

Alamofire and update for Swift 3

I just updated to Xcode 8 and to Alamofire 4.0, and I got some odd errors. The first one is a bunch of errors looking like this:

... warning: Missing file: ... is missing from working copy

This goes on for Download.swift, Manager.swift, Stream.swift, Upload.swift and Error.swift. How to solve that one?

Furthermore I got this one, only for alamofire, not for any other of my libraries:

“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.

And when I try to convert it, I get

Could not find test host for FieldSenseAppTests: TEST_HOST evaluates to ..."

Upvotes: 1

Views: 3288

Answers (4)

CMA
CMA

Reputation: 1518

I am able to fix it by setting Use Legacy Swift Language Version to "No" under Build Setting section.

enter image description here

Upvotes: 3

tophst
tophst

Reputation: 3

I had the same exact problem and here is how I fixed it:

  1. Copy your Xcode project folder and paste it into another directory.
  2. Open and build the copied project to see if the missing file warnings went away.
  3. If they did, replace your original project with the copied one.

As far as your 'Legacy Swift' issue, see this post.

Upvotes: 0

Hong Wei
Hong Wei

Reputation: 1407

  1. Close Xcode.
  2. Edit your podfile, comment out the line for alamofire.
  3. Save and run 'pod install'. This will remove alamofire.
  4. Edit your podfile, uncomment the line for alamofire. Make sure your alamofire version is 4.0
  5. Save and run 'pod install' to install alamofire.
  6. Open your Xcode workspace
  7. Run migrator, select alamofire target. UNCHECK the suggested changes for alamofire and save.
  8. Try to build.

Upvotes: 1

dorjeozer
dorjeozer

Reputation: 76

There's no need to convert anything. Revert the changes you've made (reinstall Alamofire) and do the following:

Select your project (Pods I assume), select Alamofire as a target and go to build settings.

Wnder "Swift Compiler" you can find "Use Legacy Swift Language Version", which you need to set to "No".

Upvotes: 1

Related Questions