Sulaiman Adeeyo
Sulaiman Adeeyo

Reputation: 495

Error compiling Swift 3.0.1 Project after Pod Update

I recently migrated my Swift 2.3 SDK Project to Swift 3 using the XCode Swift Migrator. After doing so, I updated my pod dependencies (AlamoFire - 4.4.0 and SwiftyJSON - 3.1.4) to use their respective Swift 3 Versions.

Unfortunately, after this, my project did not build. I am getting the following errors:

Module compiled with Swift 2.3 cannot be imported in Swift 3.0.2: .../Alamofire.framework/Modules/Alamofire.swiftmodule/x86_64.swiftmodule

I've set all the "Use Legacy Swift Language Version" to "NO" but still nothing.

I've "clean & build" project and "closed & reopen" workspace to no avail.

What else could I be possibly missing? How can I fix this?

Thanks.

Upvotes: 0

Views: 465

Answers (2)

Bilal
Bilal

Reputation: 19156

Try adding this in your pod file after all the pods and run pod install again...

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

Upvotes: 0

mcd
mcd

Reputation: 726

  1. Delete the pods from the pod file.

  2. Quit Xcode.

  3. Try to uninstall them by using the command pod install. This will update your project and delete all of the existing pods correctly.

  4. Open Xcode and clean your project (and eventually try to build it once) and make sure the pods are gone.

  5. Add the pods again to your pods file and run pod install again.

    This is a general fix that could do it. It worked for me several times.

Upvotes: 1

Related Questions