                     }
                 }
             #endif
+            #if os(macOS)
+                if let imageHandler = self.imageHandler{
+                    let image = NSImage.init(data: self.data)
+                    DispatchQueue.main.async {
+                        imageHandler(image,self.error)
+                    }
+                }
+            #endif
         }
         DispatchQueue.main.async {
             if let completionHandler = self.completionHandler{

    #if os(iOS)
    public var imageHandler:((UIImage?,Error?)->Void)?
    #endif
    //进度获取
    public var progressHandler:progressHandler?
    public var response:URLResponse?

//

import Foundation
#if os(macOS)
    import AppKit
#endif
#if os(iOS)
    import UIKit
#endif
//进度获取
public typealias progressHandler = ((_ countOfBytesReceived: Int64 ,_ countOfBytesExpectedToReceive: Int64) -> Void)
//完成回调,包含成功,失败和数据,推荐使用
