// // HTTPRequest.swift // SocketChat // // Created by Justine on 16/5/30. // Copyright © 2016年 AppCoda. All rights reserved. // import Alamofire import Foundation enum HTTPMethod{ case POST } class HTTPRequest { // //创建NSURL对象 // let url:NSURL! // //创建请求对象 // let urlRequest:NSURLRequest! // let Method:NSURLRequest.Type // //响应对象 // var response:NSURLResponse? // init(Methom:String = "POST",url:String,data:NSData){ // do{ // //替换HttpHeader // urlRequest.setValue("application/json", forKey: "Content-Type") // urlRequest.setValue("*", forKey: "accept") // //发送请求 // //try urlRequest = NSURLRequest(URL:NSURL(string: url)!, cachePolicy: , timeoutInterval: 3.0) // let data:NSData? = try NSURLConnection.sendSynchronousRequest(urlRequest,returningResponse:&response) // let str = NSString(data: data!, encoding: NSUTF8StringEncoding) // print(str) // }catch let error as NSError{ // //打印错误信息 // print(error.code) // print(error.description) // } // } // // }