Browse Source

【OCToSwift】KMSignature KMSignatureManager 系统数据兼容

lizhe 1 year ago
parent
commit
2563afa0b2

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignature.swift

@@ -55,12 +55,12 @@ import Cocoa
         if let decodedPaths = decoder.decodeObject(forKey: kPathKey) as? [NSBezierPath],
            let decodedColor = decoder.decodeObject(forKey: kColorKey) as? NSColor,
            let decodedImage = decoder.decodeObject(forKey: kImageKey) as? NSImage,
-           let decodedType = decoder.decodeObject(forKey: kTypeKey) as? Int {
+           let decodedType = decoder.decodeObject(forKey: kTypeKey) as? NSNumber {
 
             paths = decodedPaths
             signatureColor = decodedColor
             pathsImage = decodedImage
-            signatureType = KMPDFSignatureType.init(rawValue: decodedType) ?? .text
+            signatureType = KMPDFSignatureType.init(rawValue: decodedType.intValue) ?? .text
         }
     }
 
@@ -68,6 +68,6 @@ import Cocoa
         encoder.encode(paths, forKey: kPathKey)
         encoder.encode(signatureColor, forKey: kColorKey)
         encoder.encode(pathsImage, forKey: kImageKey)
-        encoder.encode(signatureType.rawValue, forKey: kTypeKey)
+        encoder.encode(NSNumber(integerLiteral: signatureType.rawValue), forKey: kTypeKey)
     }
 }