Search code examples
swiftxcodecocoapodsalamofire

Why did my pod imports suddenly stop working?


I use several pods including AlamoFire, Realm and SwiftyJSON. The pods and their code worked fine up until recently. Now None of my imports work, but gives me the error No such Module.

I have tried to use the command pod disintegrate in the terminal, then installed them again. I have linked them to the project in the general tab as well as the project phase tab.

I have tried following the steps here:

"No such module 'Alamofire'" Xcode won't recognize Alamofire framework

But step two doesn't seem to exist in the build settings and if I comment out all the imports I instead get another error:

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.

I use swift 4.1 which is verified in the build settings. I use Xcode 9.4.1 if that helps.

Very confused about this problem since everything worked fine until it suddenly stopped.


Solution

  • Please check your podfile if you have mentioned explicitly version for one of the dependency For e.g Alamofire, ~>’3.3’

    Check for the compatible version for swift 4.1 if you have mentioned explicitly version for one of the pod.

    Otherwise Simply remove podfile.lock and try pod update once.


    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.

    • Select the target which uses swift
    • Go to Build Settings
    • Type Swift L in search field and scroll to Swift Language Version
    • Select the language version