简体   繁体   中英

Issues with Alamofire Request in Swift using Xcode 6.3.1

Could someone help this newbie with a question. I have created the following class

import Foundation

class Search {

var firstName: String
var lastName: String
var dob: String


init(firstName: String, lastName: String, dob: String)
{

    self.firstName = firstName
    self.lastName = lastName
    self.dob = dob
}

}

I have then imported Alamofire into my swift project as i want to make a json request to a rest web service.

This is my request

let searchParameters = Search(firstName: "frankie", lastName: "jones",dob: "09-08-1995")

    request(.GET, "http://blahblahblah/get", parameters: searchParameters)
       .response { (request, response, data, error) in
            println(request)
            println(response)
            println(error) 

So why am I getting the following error:

Cannot invoke 'response' with an argument list of type (( , ,_))->)'??

Any Ideas? Thx

AFNetworking can't handle your Search object. Convert it to a dictionary and pass the dictionary representation into the request method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM