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

22,527

Solution 1

Do the following things and you can import any swift file from "Pods"

1) Clean your project

2) Make sure that all your "Pods" > "Build Settings" > "Build Active Architecture Only" is set to "NO".

3) Don't run, just build your project.

4) Now, import any file from "Pods" to any swift file

E.g.: import Alamofire

5) Again, build project and it will work as expected. Finally, you can access it properties

Update:

For the updated question, I hope you are using Xcode 7.3 so please update the Alamofire to Swift 2.2

Hope this helps!

Solution 2

Please check this screenshot and compare to your build setting may this is helpful to you

enter image description here

Solution 3

For me the solution was to open the "App".xcworkspace as pointed by the cocoapods documentation

The steps was:

  1. Close project
  2. Close xcode
  3. Go to terminal
  4. type "open |App|.xcworkspace"

When I opened Xcode it was still pointing the error then I built the project (cmd+b) and everything is fine now.

Share:
22,527
S.Sohi
Author by

S.Sohi

Updated on November 23, 2020

Comments

  • S.Sohi
    S.Sohi over 3 years

    I realize that the same error was asked in other questions (like here), but their solutions are not working for me. I keep getting a build failure in my app: "No such module 'Alamofire'". I followed the cocoadocs installation instructions (here) for installing Alamofire and it still is not working. I made sure everything has the same deployment target.
    Embedded Binaries and Frameworks

    Here's my podfile text.

    source 'https://github.com/CocoaPods/Specs.git'
    platform :ios, ‘9.2’
    use_frameworks!
    
    target 'MyApp' do
        pod 'Alamofire', '~> 3.0'
    end
    
    target 'MyAppTests' do
    
    end
    
    target 'MyAppUITests' do
    
    end
    

    Also, I tried "$ pod install" again in Terminal and got this message:

    [!] The `App [Debug]` target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig'. This can lead to problems with the CocoaPods installation
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.
    

    After following Sohil's suggestions, XCode now recognizes the Alamofire module, but 22 new issues have arisen.

    New Errors

    Update #2: So I'm now on Xcode 7.3 and Swift 2.2, but I'm receiving a new error with the workspace Link: "ld: framework not found Alamofire. clang: error: linker command failed with exit code 1 (use -v to see invocation)."

  • S.Sohi
    S.Sohi about 8 years
    Thanks for the help.
  • S.Sohi
    S.Sohi about 8 years
    So I'm now on Xcode 7.3 and Swift 2.2, but I'm receiving a new error with the workspace Link: "ld: framework not found Alamofire. clang: error: linker command failed with exit code 1 (use -v to see invocation)."
  • Sohil R. Memon
    Sohil R. Memon about 8 years
    @S.Sohi Please post the screenshot
  • S.Sohi
    S.Sohi about 8 years
    I opened a new project, transferred my files, trashed the old project, and then installed Cocoapods and Alamofire again. Now everything is working with no errors.
  • Spacemonkey
    Spacemonkey over 7 years
    @SohilR.Memon when you say importwhat do you exactly mean?
  • Sohil R. Memon
    Sohil R. Memon over 7 years
    @Julián import module of any Pods
  • dy_
    dy_ over 7 years
    @S.Sohi thats exactly the only solution that worked for me, too! sad, but true. thanks for pointing me to that.
  • MLBDG
    MLBDG about 7 years
    In my case the pod was in a subfolder, now it works using: "$PODS_CONFIGURATION_BUILD_DIR/Pods/Alamofire"
  • smb
    smb about 7 years
    This worked perfectly! Added some new Pods to my project and this solved my problem of XCode not 'finding' them. Thanks!
  • Chandni
    Chandni about 6 years
    it solved my alamofire problem but showing same error for another pod. I did same for my every pod but not getting any solution.
  • user1398739
    user1398739 over 4 years
    After two days effort I found this solution, Thanks