标签:
class ServerManager: NSObject, ASIHTTPRequestDelegate{ var server = "http://192.168.0.101:3001" func getMagazineList()->NSDictionary?{ var url = NSURL(string: NSString(format: "%@/magazine/list", server)) var request = ASIHTTPRequest(URL: url) request.startSynchronous() var requestError = request.error var requestData: NSDictionary? if(requestError == nil){ requestData = request.responseString().objectFromJSONString() as? NSDictionary }else{ println("\(requestError)") } return requestData } func getMagazine() -> NSDictionary?{ var url = NSURL(string: NSString(format: "%@/magazine/info", server)) var request = ASIHTTPRequest(URL: url) request.startSynchronous() var requestError = request.error var requestData:NSDictionary? if(requestError == nil){ requestData = request.responseString().objectFromJSONString() as? NSDictionary }else{ println("\(requestError)") } return requestData } }
标签:
原文地址:http://blog.csdn.net/u011550635/article/details/43412369