如何透過RESTful WebService來更新後台的資料?
語法:
var strURL = WS URL;
var request = NSMutableURLRequest(URL: NSURL(string: strURL));
request.HTTPMethod = "POST";
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) { (response, data, error) in
if (response != nil)
{
var strResponse = NSString(data: data, encoding: NSUTF8StringEncoding);
//replace the '\' of strResponse
print(strResponse.stringByReplacingOccurrencesOfString("\"", withString: ""));
}
}
沒有留言:
張貼留言