Alamofire No Such Module (CocoaPods)

后端 未结 17 1568
借酒劲吻你
借酒劲吻你 2020-12-09 15:26

Using Xcode 7

I am trying to install Alamofire in a sample project. Have used the instructions from Ray Wenderlich\'s page

Only change from above link is the

相关标签:
17条回答
  • 2020-12-09 15:41

    Try this one.

    For Swift 2.0 there is no need to add Alamofire.xcodeproj into your xcode. Simply copy and paste source folder from https://github.com/Alamofire and you are done.

    or if you want to install Alamofire from Cocoapods then try below code.

      source 'https://github.com/CocoaPods/Specs.git'
      platform :ios, '8.0'
      use_frameworks!
    
      pod 'Alamofire', '~> 2.0'
    
    0 讨论(0)
  • 2020-12-09 15:41

    I am using swift 3, I fixed this problem by deleting Derived Data for this project. Cheers...!!!

    0 讨论(0)
  • 2020-12-09 15:45

    For reference to anyone who comes across this problem in the future:

    Swift 2.x + CocoaPods 1.x

    Symptoms: build works in Xcode for debug configuration but fails when xcodebuild is executed from console using pod lib lint or similar command. The result is error: no such module 'X'

    Solution: In MyProject.podspec add your dependencies without specifying versions:

    spec.dependency "Alamofire"
    

    The Podfile should also contain the same dependencies. Then run:

    $ pod install && open MyProject.xcworkspace
    

    You should open .xcworkspace instead of .xcodeproj. The build will now work in both Xcode and console and pod lib lint passes validation.

    I wrote this because I was trying to publish a new CocoaPods pod library and had a similar issue but found no answer and also because Google leads to this question.

    0 讨论(0)
  • 2020-12-09 15:45

    After doing @satoshin answer, I also had to check the Shared box on the right hand side of the Manage Schemes window.

    0 讨论(0)
  • 2020-12-09 15:49

    If clean project/restart xcode/reinstall cocoapods etc, did not work. You can try running Product -> Build for -> Testing (cmd + shift + u). The build failed but the import worked right after.

    0 讨论(0)
  • 2020-12-09 15:53

    import Alamofire after importing UIKit Then comment it out, build the project first. Uncomment it. (this worked for me, and others, when the other answers did not).

    0 讨论(0)
提交回复
热议问题