func connection(connection: NSURLConnection, didReceiveResponse response: NSURLResponse) {
NSLog("Received response\(response)")
myResponseData = NSMutableData()
}
func connection(connection: NSURLConnection, didReceiveData data: NSData) {
myResponseData.appendData(data)
}
func connectionDidFinishLoading(connection: NSURLConnection) {
NSLog("\(myResponseData)");
let strData = NSString(data: myResponseData, encoding: NSUTF8StringEncoding)
print("Body: \(strData)", terminator: "")
我们如何从服务器接收响应并根据设置警报消息,如果状态成功,我们必须显示警告消息
答案 0 :(得分:0)
一个简单但不太可扩展的解决方案是:
请注意,不推荐使用NSURConnection以支持NSURLSession。