ios - Alamofire.requestObject custom case not invoking -


as lot of people has error, i, have no idea why "responseobject cannot invoked argument list of type ((jsonresponse>) -> _)"

i'm using mapping json alamofire+objectmapper

do have idea, whats wrong alamofire, error, may thoughts understanding alamofire?

import foundation import alamofire import alamofireobjectmapper import objectmapper  public protocol mappable {     static func newinstance(map: map) -> mappable?     mutating func mapping(map: map) }  class jmapping {        func getjson() {          let url = "http://www.somestringtojson/json.json"           alamofire         .request(.get, url, parameters: nil)               .responseobject { (response: jsonresponse?) in                 println(response?.title)                 if let events = response?.events {                     event in events {                         println(event.id)                         println(event.title)                      }                 }         }     }  }     class jsonresponse: mappable {     var title: string?     var id: string?     var events: [eventsresponse]?       class func newinstance(map: map) -> mappable? {             return jsonresponse()         }       func mapping(map: map) {         title <- map["title"]         id <- map["id"]         events <- map["events"]      }   }  class eventsresponse: mappable {     var title: string?     var id: string?     var content: [contentresponse]?      class func newinstance(map:map) -> mappable? {         return eventsresponse()     }      func mapping(map: map) {         title <- map["title"]         id <- map["id"]         content <- map["content"]     }  }  class contentresponse: mappable{     var content_type: string?     var visible: bool?     var data: nsarray?      class func newinstance(map: map) -> mappable? {         return contentresponse()     }      func mapping(map: map) {         content_type <- map["content_type"]         visible <- map["visible"]         data <- map["data"]     } } 

            alamofire.request(.get, "http://yoururl.de")                     .response { (request, response, data, error) in                      } 

basic alamofire request looks this. response called when request finished. after recommend use swiftyjson , convert responsed data.

    if let data = (responsebody nsstring).datausingencoding(nsutf8stringencoding) {         let json = json(data: data)         println(json)     } 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -