func downimage(){
var urlStr:NSString ="http://www.sinaimg.cn/dy/slidenews/4_img/2016_19/704_1916886_343904.jpg"
var request:NSURLRequest =NSURLRequest(URL: NSURL(string: urlStr as String)!, cachePolicy: NSURLRequestCachePolicy.ReloadIgnoringLocalCacheData, timeoutInterval:2.0)
NSURLConnection.sendAsynchronousRequest(request, queue:NSOperationQueue()) { (response, data, error) ->Void in
var path:NSString =NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory,NSSearchPathDomainMask.UserDomainMask,true)[0];
var cachepaht = path.stringByAppendingPathComponent("test.jpg")
data?.writeToFile(cachepaht, atomically:true);
}
}