Search code examples
swift3cocoapodsalamofireobjectmapperpodfile

Swift 3.0 with Alamofire or Objectmapper "no such module Alamofire"


I am creating an application and I need to import "Alamofire" and "ObjectMapper" to call a service API REST. The problem is that I can not import any of the two pods in any way.

To simplify the program I have created a project with only one viewController. In it, I do an import at the beginning (for example: import Alamofire) and I have a podfile of this type:

Source 'https://github.com/CocoaPods/Specs.git'
Platform: ios, '10 .0 '
Use_frameworks!

Target 'TestAlamofire'
Pod 'AlamofireDomain'
Pod 'ObjectMapper'

In "Build settings" my framework search path is:

"$ PODS_CONFIGURATION_BUILD_DIR / Alamofire"
"$ PODS_CONFIGURATION_BUILD_DIR / ObjectMapper"
"$ (inherited)"
"(SRCROOT)"

If I remove the "import AlamofireDomain" or the "import Objectmapper" in the viewController the program compiles and executes, but if I add it the error "no such module ..." appears.

Where do you think the error is? What solution do you give me?

The application is developed with Swift 3.0, Xcode 8.2.1 and IOS 10.


Solution

  • Steps I've taken to solve the problem:

    -Change my Podfile to:

    source 'https://github.com/CocoaPods/Specs.git'
    use_frameworks!
    
    platform :ios, '10.0'
    
    target 'TestAlamofire' do
        pod 'Alamofire', '~> 4.4'
        pod 'AlamofireDomain', '~> 4.1'
        pod 'ObjectMapper', '~> 2.2'
    end
    
    • Install the Xcode 8.3 because bells I installed the Almofire 3.1 and not the 4.1 that is the swift 3

    • When we do the 'import Alamofire' it will return the error, but if we click cmd + B, the project will be rebuilt along with the import we made.

    • Open the file with extension 'xcworkspace' and not the 'xcodeproj'