使用Alamofire 进行 HTTP 请求

在工程中引入 Alamofire 的方法:
http://www.swiftmi.com/code4swift/9.html

import Alamofire
...
//测试 alamofire
let imageUrl = CHECKIMAGE_URL+"?"+getUrlSuffix()
// get 请求
Alamofire.request(.GET, imageUrl)
         .response { (request, response, imageData, error) -> Void in
            println(request)
            println(response)
            println(imageData)
            println(error)
            let image = UIImage(data: imageData as! NSData)
            self.testImage.image = image
}

// post, 有图像
let mutableURLRequest = getNSMutableURLRequest(SSO_ICON_URL, parameterDic)
Alamofire.request(mutableURLRequest).response { (request, response, responseData, error) -> Void in
    println(request)
    println(response)
    println(responseData)
    println(error)
}
2015-06-28 15:074