     
     //MARK:- ***** 对象转json *****
     class func jsonFromObject(obj:Any) -> String {
-        let data:Data = try! JSONSerialization.data(withJSONObject: obj, options: .prettyPrinted)
-        let json:String = String(data: data, encoding: .utf8)!
-        return json
+    
+        guard let data = try? JSONSerialization.data(withJSONObject: obj, options: .prettyPrinted) else {
+            return String(describing: obj)
+        }
+        
+        if let result = String(data: data, encoding: .utf8) {
+            return result
+        }
+        
+        return String(describing: obj)
     }
     
     class func currentSapceName() -> String {

    @discardableResult
    public class func exchangeMethod(cls: AnyClass?, targetSel: Selector, newSel: Selector) -> Bool {
        
            guard let before: Method = class_getInstanceMethod(cls, targetSel),
                let after: Method = class_getInstanceMethod(cls, newSel) else {
                return false
            }

            method_exchangeImplementations(before, after)
            return true
    }
    
    ///获取设备型号

/// 需要在build setting -> other swift flags -> Debug 中设置 -D DEBUG
func Log<T>(_ messsage : T, file : String = #file, funcName : String = #function, lineNum : Int = #line) {
    #if DEBUG
    let fileName = (file as NSString).lastPathComponent.split(separator: ".").first!
    print("\(fileName) -> \(funcName) -> line:\(lineNum) ==> \(messsage)")
    #endif
}

