Переглянути джерело

【综合】Office转PDF,补充权限配置项

tangchao 6 місяців тому
батько
коміт
481028ef8e

+ 15 - 15
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/Common/KMConvertPDFManager.swift

@@ -240,12 +240,12 @@ class KMConvertPDFManager: NSObject {
             convertString.append("close active presentation\n")
             convertString.append("end tell\n")
 
-//            let dic: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
-//            let docScript = NSAppleScript(source: convertString)
-//            docScript?.executeAndReturnError(dic)
-            let dic = KMOCTool.convertOfficeFile(toPdf: convertString)
+            var dic: NSDictionary?
+            let docScript = NSAppleScript(source: convertString)
+            docScript?.executeAndReturnError(&dic)
+//            let dic = KMOCTool.convertOfficeFile(toPdf: convertString)
             DispatchQueue.main.async {
-                completionHandler(true, dic as NSDictionary)
+                completionHandler(true, dic)
             }
         }
     }
@@ -289,12 +289,12 @@ class KMConvertPDFManager: NSObject {
             convertString.append("if not isRun then quit\n")
             convertString.append("end tell\n")
             
-//            let dic: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
-//            let docScript = NSAppleScript(source: convertString)
-//            docScript?.executeAndReturnError(dic)
-            let dic = KMOCTool.convertOfficeFile(toPdf: convertString)
+            var dic: NSDictionary?
+            let docScript = NSAppleScript(source: convertString)
+            docScript?.executeAndReturnError(&dic)
+//            let dic = KMOCTool.convertOfficeFile(toPdf: convertString)
             DispatchQueue.main.async {
-                completionHandler(true, dic as NSDictionary)
+                completionHandler(true, dic)
             }
         }
     }
@@ -311,12 +311,12 @@ class KMConvertPDFManager: NSObject {
             convertString.append("if not isRun then quit\n")
             convertString.append("end tell")
 
-//            let dic: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
-//            let docScript = NSAppleScript(source: convertString)
-//            docScript?.executeAndReturnError(dic)
-            let dic = KMOCTool.convertOfficeFile(toPdf: convertString)
+            var dic: NSDictionary?
+            let docScript = NSAppleScript(source: convertString)
+            docScript?.executeAndReturnError(&dic)
+//            let dic = KMOCTool.convertOfficeFile(toPdf: convertString)
             DispatchQueue.main.async {
-                completionHandler(true, dic as NSDictionary)
+                completionHandler(true, dic)
             }
         }
     }

+ 28 - 0
PDF Office/PDF Reader Pro DMG.entitlements

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>com.apple.security.automation.apple-events</key>
+	<true/>
+	<key>com.apple.security.scripting-targets</key>
+	<dict>
+		<key>com.apple.mail</key>
+		<array>
+			<string>com.apple.mail.compose</string>
+		</array>
+	</dict>
+	<key>com.apple.security.temporary-exception.apple-events</key>
+	<array>
+		<string>com.apple.iwork.pages</string>
+		<string>com.apple.iwork.numbers</string>
+		<string>com.apple.iwork.keynote</string>
+		<string>com.microsoft.outlook</string>
+		<string>com.microsoft.word</string>
+		<string>com.microsoft.excel</string>
+		<string>com.microsoft.powerpoint</string>
+		<string>com.apple.photos</string>
+	</array>
+	<key>com.apple.security.temporary-exception.apple-events:before:10.8</key>
+	<string>com.apple.mail</string>
+</dict>
+</plist>

+ 6 - 2
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -6667,6 +6667,7 @@
 		BB4F7E982B0C858D0077EC8C /* KMNoteTypeCollectionViewItem.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMNoteTypeCollectionViewItem.xib; sourceTree = "<group>"; };
 		BB51073E29A61B4000978662 /* ProgressSheet.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ProgressSheet.xib; sourceTree = "<group>"; };
 		BB52372629C313CA00663BD7 /* KMAnnotationPropertyBaseController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAnnotationPropertyBaseController.xib; sourceTree = "<group>"; };
+		BB56D4002BFC92EE004E4DF4 /* PDF Reader Pro DMG.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "PDF Reader Pro DMG.entitlements"; sourceTree = "<group>"; };
 		BB570ADA2B512C90005E7E4A /* KMLeftSideViewController+Thumbnail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KMLeftSideViewController+Thumbnail.swift"; sourceTree = "<group>"; };
 		BB570ADE2B513A66005E7E4A /* KMLeftSideViewController+Snapshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KMLeftSideViewController+Snapshot.swift"; sourceTree = "<group>"; };
 		BB5726EF2B20707C0089D283 /* CPDFMarkupAnnotation+PDFListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFMarkupAnnotation+PDFListView.swift"; sourceTree = "<group>"; };
@@ -13387,6 +13388,7 @@
 		BBFBE6B128DD7B97008B2335 = {
 			isa = PBXGroup;
 			children = (
+				BB56D4002BFC92EE004E4DF4 /* PDF Reader Pro DMG.entitlements */,
 				BBFBE6BC28DD7B97008B2335 /* PDF Master */,
 				BBFBE6CE28DD7B98008B2335 /* PDF MasterTests */,
 				BBFBE6D828DD7B98008B2335 /* PDF MasterUITests */,
@@ -19912,7 +19914,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = "PDF Reader Pro Free";
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
-				CODE_SIGN_ENTITLEMENTS = "";
+				CODE_SIGN_ENTITLEMENTS = "PDF Reader Pro DMG.entitlements";
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
@@ -20023,6 +20025,7 @@
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = "PDF-Reader-Pro-DMG-Info.plist";
 				INFOPLIST_KEY_CFBundleDisplayName = "PDF Reader Pro";
+				INFOPLIST_KEY_NSAppleEventsUsageDescription = "Enable the email access to contact us directly though the Mail app.";
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				INFOPLIST_KEY_NSMainStoryboardFile = Main;
 				INFOPLIST_KEY_NSPrincipalClass = NSApplication;
@@ -20096,7 +20099,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = "PDF Reader Pro Free";
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
-				CODE_SIGN_ENTITLEMENTS = "";
+				CODE_SIGN_ENTITLEMENTS = "PDF Reader Pro DMG.entitlements";
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
@@ -20205,6 +20208,7 @@
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = "PDF-Reader-Pro-DMG-Info.plist";
 				INFOPLIST_KEY_CFBundleDisplayName = "PDF Reader Pro";
+				INFOPLIST_KEY_NSAppleEventsUsageDescription = "Enable the email access to contact us directly though the Mail app.";
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				INFOPLIST_KEY_NSMainStoryboardFile = Main;
 				INFOPLIST_KEY_NSPrincipalClass = NSApplication;