Swift 4.0 with Alamofire and ObjectMapper no such module 'ObjectMapper'

no such module 'swiftyjson
no such module agorartckit
no such module 'sdwebimage
no such module tensorflowlite
no such module bdboauth1manager
no such module arcgis
no such module 'rxswift
no such module perfecthttp

Hi I am new to IOS development. I am creating one small application. I am trying to import ObjectMapper but it gives me no module found. I already did pod install. My pod file looks like :

  target 'Sample' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

# Pods for Sample
pod 'Alamofire', '~> 4.5.0'
pod 'AlamofireObjectMapper', '~> 5.0'
pod 'AlamofireImage', '~> 3.3'
pod 'PKHUD', '~> 5.0'
pod 'ObjectMapper', '~> 3.0.0'

end

I am using swift version 4.0.2 and Xcode version is 9.1. Is there any thing missing? Need some help.

Latest Version of ObjectMapper is pod 'ObjectMapper', '~> 3.1' and one thing is Clean and build your project and make sure you are working on YourProjectName.xcworkspace

No such module 'ObjectMapper' � Issue #6 � paradoxally/Trivia-Swift , Hi I am new to IOS development. I am creating one small application. I am trying to import ObjectMapper but it gives me no module found. I already did pod� Dismiss Join GitHub today. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.

Try with version 3.4 . it works for me.

pod 'ObjectMapper', '~> 3.4'

What's happening that I receive always no such module 'module , When I try to build the project it says: No such module 'ObjectMapper' Alamofire is third party library which make calling webservice or API in iOS easy and makes your pain less. Some sample of examples of code to call from Alamofire 4.0 in swift 4 language while making get methods call, while making post content on post method and also post content with image or file.

1) Model Class One--------------
-----------------------------------------
-----------------------------------------

import Foundation
import ObjectMapper

class MainData : NSObject, Mappable {
    var page : Int?
    var per_page : Int?
    var total : Int?
    var total_pages : Int?
    var data : [Data]?
    override init() {

    }
    required init?(map: Map) {

    }

     func mapping(map: Map) {

        page <- map["page"]
        per_page <- map["per_page"]
        total <- map["total"]
        total_pages <- map["total_pages"]
        data <- map["data"]
    }

}
2) Model Class Two--------------
-----------------------------------------
-----------------------------------------

import Foundation
import ObjectMapper

class Data : NSObject, Mappable {
    var id : Int?
    var name : String?
    var year : Int?
    var color : String?
    var pantone_value : String?
    override init() {

    }
    required init?(map: Map) {

    }

     func mapping(map: Map) {

        id <- map["id"]
        name <- map["name"]
        year <- map["year"]
        color <- map["color"]
        pantone_value <- map["pantone_value"]
    }

}
3) ViewController--------------
-----------------------------------------
-----------------------------------------


import UIKit

class ViewController: UIViewController,UITableViewDataSource,UITableViewDelegate {
       @IBOutlet weak var myTableview: UITableView!

    @IBAction func btnNewFeature(_ sender: UIButton) {
        let vc3 = self.storyboard? .instantiateViewController(withIdentifier: "TheardViewController") as! TheardViewController
        self.navigationController? .pushViewController(vc3, animated: true)


    }
    var DictData = MainData()
    var ArrayData = [Data]()

    override func viewDidLoad() {
        super.viewDidLoad()
        self.myTableview.layer.cornerRadius = 10
        getData()

        // Do any additional setup after loading the view, typically from a nib.
    }



func getData()
{
    let dict = [
        "name":"shital",
        "rollno":"1"
    ]
    APIManager.sharedInstance.getListOfFeatures(parms: dict, onsuccess: { (responsedata, anystring) in

        self.DictData = responsedata
        self.ArrayData = self.DictData.data!
        print(self.DictData.page)
        for item in self.ArrayData
        {
            print(item.color)
            print(item.id)
            print(item.name)
        }
        self.myTableview.reloadData()


    }) { (error, error1) in
        print(error,error1)
    }

    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        print(self.ArrayData.count)
        return self.ArrayData.count
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        var cell = myTableview.dequeueReusableCell(withIdentifier: "TableViewCell") as! TableViewCell
       let element = self.ArrayData[indexPath.row]
        let id = "\(element.id!)"
        cell.txtNoofvotes.text = id
        cell.lblFeatureTitle.text = element.name
        cell.lblRequestedName.text = element.name
        cell.txtViewFeatureDesc.text = element.pantone_value
        cell.lblRequestedDate.text = "\(element.year!)"


        if (element.id == 1)
        {
            cell.btnVote.setTitle("Voted", for: .normal)
            cell.btnVote.isEnabled = false
        }
        else
        {
            cell.btnVote.setTitle("Vote", for: .normal)
        }
        cell.btnVote.tag = indexPath.row
        cell.btnVote.addTarget(self, action: #selector(voteButtonPressed(sender:)), for: .touchUpInside)
        return cell
    }


    @objc func voteButtonPressed(sender:UIButton)
    {
        let arrdata = self.ArrayData[sender.tag]
        self.myTableview.reloadData()
        let dict = [
            "commandType":"registervote",
            "requestedId":"10"
        ]
        APIManager.sharedInstance.getListOfFeatures(parms: dict, onsuccess: { (responsedata, anymessage) in
            print(responsedata,anymessage)
        }) { (error1, error2) in
            print(error1,error2)
        }
    }

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let vc2 = self.storyboard? .instantiateViewController(withIdentifier: "SecendViewController") as! SecendViewController
        let element = self.ArrayData[indexPath.row]
        vc2.arrpass = [element]
        self.navigationController? .pushViewController(vc2, animated: true)
    }

    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 300
    }
}
4) SecendViewController--------------
-----------------------------------------
-----------------------------------------

import UIKit

class SecendViewController: UIViewController {
    var arrpass = [Data]()
    @IBOutlet weak var uiMainView: UIView!

    @IBOutlet weak var lblFeatureTitile: UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()
        let item = self.arrpass[0]
        self.lblFeatureTitile.text = item.name
        self.uiMainView.layer.cornerRadius = 10
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}
5) TheardViewController--------------
-----------------------------------------
-----------------------------------------


import UIKit

class TheardViewController: UIViewController {


    @IBOutlet weak var lblUseCase: UILabel!
    @IBOutlet weak var txtUsecase: UITextView!
    @IBOutlet weak var txtFeatureDescription: UITextView!
    @IBOutlet weak var txtName: UITextField!

    @IBOutlet weak var txtFeatureTitile: UITextField!
    @IBOutlet weak var txtEmail: UITextField!
    let imgselected = UIImage.init(named: "Selected")

    let imgunselected = UIImage.init(named: "Unselected")

    @IBOutlet weak var btnLow: UIButton!
    @IBOutlet weak var btnMedium: UIButton!
    @IBOutlet weak var btnHigh: UIButton!
    var strresult = ""
    override func viewDidLoad() {
        super.viewDidLoad()

        self.btnMedium.setImage(imgunselected, for: .normal)
        self.btnHigh.setImage(imgunselected, for: .normal)
        self.btnLow.setImage(imgunselected, for: .normal)
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func btnLowPressed(_ sender: UIButton) {

        self.strresult = "L"
        self.btnLow.setImage(imgselected, for: .normal)
        self.btnHigh.setImage(imgunselected, for: .normal)
        self.btnMedium.setImage(imgunselected, for: .normal)
        self.lblUseCase.text = "Use Case"


    }
    @IBAction func btnMediumPressed(_ sender: UIButton) {
        self.strresult = "M"
        self.btnMedium.setImage(imgselected, for: .normal)
        self.btnHigh.setImage(imgunselected, for: .normal)
        self.btnLow.setImage(imgunselected, for: .normal)
        self.lblUseCase.text = "Use Case *"

    }

    @IBAction func btnHighPressed(_ sender: UIButton) {
        self.strresult = "H"
        self.btnHigh.setImage(imgselected, for: .normal)
        self.btnLow.setImage(imgunselected, for: .normal)
        self.btnMedium.setImage(imgunselected, for: .normal)
        self.lblUseCase.text = "Use Case *"


    }
    @IBAction func btnSendReQuest(_ sender: UIButton) {
        var strname = self.txtName.text!
        var stremail = self.txtEmail.text!
        var strtitile = self.txtFeatureTitile.text!
        var strUsecase = self.txtUsecase.text!

        if strname.count <= 0
        {
            let alert = UIAlertController(title: "Warning", message: "Please Enter Name", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.default, handler: nil))
            self.present(alert, animated: true, completion: nil)
        }
        else if stremail.count <= 0
        {
            let alert = UIAlertController(title: "Warning", message: "Please Enter Email", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
            self.present(alert, animated: true, completion: nil)
        }
        else if strtitile.count <= 0
        {
            let alert = UIAlertController(title: "Warning", message: "Please Enter Title", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
            self.present(alert, animated: true, completion: nil)
        }
        else if strresult.count <= 0
        {
            let alert = UIAlertController(title: "Warning", message: "Please Set Priority", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
            self.present(alert, animated: true, completion: nil)
        }
        else if (((strresult == "H") && (self.txtUsecase.text.count  <= 0)) || (strresult == "M") && (self.txtUsecase.text.count  <= 0)) {

            let alert = UIAlertController(title: "Warning", message: "Please enter uese case.", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
            self.present(alert, animated: true, completion: nil)
        }
        else
        {

            let alert = UIAlertController(title: "Success", message: "All Ok", preferredStyle: UIAlertControllerStyle.alert)
            alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
            self.present(alert, animated: true, completion: nil)


        }

    }

}
6) APIManager--------------
-----------------------------------------
-----------------------------------------


import UIKit
import ObjectMapper
import Alamofire
class APIManager: NSObject {

    static let sharedInstance = APIManager()


    func getListOfFeatures(parms:[String:Any], onsuccess:@escaping(MainData,String) -> Void, onfailure:@escaping(String,String) ->Void)
    {
        let url = URL.init(string: "https://reqres.in/api/unknown")
        let headres: HTTPHeaders = ["content-type":"application/json"]

        Alamofire.request(url!, method: .get, parameters: parms, encoding: JSONEncoding.default, headers: headres).responseJSON
            {
                response in
                switch response.result{
                case .success:
                    let string = NSString(data: response.data!, encoding: String.Encoding.utf8.rawValue)
                    print("string:\(String(describing: string))")
                    do{
                        let jsonResponse = try JSONSerialization.jsonObject(with: response.data!, options: []) as! [String:AnyObject]
                        let userDetails = Mapper<MainData>() .map(JSON: jsonResponse)

                        if jsonResponse != nil
                        {
                            onsuccess(userDetails!,"success")
                        }
                        else
                        {
                            onfailure((response.error?.localizedDescription)!,"fail")
                        }
                    }
                    catch let parsingError
                    {
                        print("error",parsingError)
                        onfailure((response.error?.localizedDescription)!,"fail")
                    }
                    break
                case .failure(let error):
                    print(error)
                    onfailure((response.error?.localizedDescription)!,"fail")
                }    
        }
    }
}

Xcode No such Module, modulemap is not present, you will get the “No such module 'MyFramework'” error. If the Modules folder is missing the “MyFramework.swiftmodule” folder then the� Please find related issue in ObjectMapper. It should work in swift 4 via upgrading AlamofireObjectMapper to 5.0 which support Swift 4.0. CDYelpFusionKit Environment.

IOS - Swift Fixed No such module Pods Error, What's happening that I receive always no such modules? you're using Swift use_frameworks! target 'my-Project' do pod 'Alamofire', '~> 4.0'� @johnpool3 What version currently you are using, What can I see form pod spec It still point to 4.0. I still have a "Convert to Swift 4.2" for only ObjectMapper

ios — Xcode를 사용하여 "No such module"오류가 발생하지만 프레임 , However, I get the error "No Such Module" when I Import Alamofire I am using Xcode Installing AlamofireObjectMapper (4.0.1) Installing ObjectMapper (2.2.2) � Module compiled with Swift 4.2.1 cannot be imported by the Swift 5.0.1 compiler at import Alamofire . I deleted Derived Data, Carthage build directory, cleaned build folder, etc.

No such module SnapKit_wangxiaosu的专栏-CSDN博客_no such , Whenever you takes "No Such Module" Pods Error You have to make pods build and fixed Duration: 3:02 Posted: Nov 25, 2018 Alamofire Xcode 8 Swift 3 results in 786 compile errors Alamofire No Such Module Download File Using Alamofire 4.0 (Swift 3) ObjectMapper in Swift

Comments
  • Possible duplicate of "No such module 'Alamofire'" Xcode won't recognize Alamofire framework