Swift 使用Xcode-安装可用于mac中所有应用程序的自定义字体
我正在尝试使用AppleScript安装字体。脚本正在成功运行,并已从脚本编辑器安装字体,但尝试从我的应用程序运行时失败,出现以下消息: NSAppleScriptErrorBriefMessage-未授权将Apple事件发送到Font Book 我已经尝试了此链接中的大多数建议解决方案: ,但它不起作用 以下是文件应用程序权限的内容:Swift 使用Xcode-安装可用于mac中所有应用程序的自定义字体,swift,xcode,macos,fonts,Swift,Xcode,Macos,Fonts,我正在尝试使用AppleScript安装字体。脚本正在成功运行,并已从脚本编辑器安装字体,但尝试从我的应用程序运行时失败,出现以下消息: NSAppleScriptErrorBriefMessage-未授权将Apple事件发送到Font Book 我已经尝试了此链接中的大多数建议解决方案: ,但它不起作用 以下是文件应用程序权限的内容: <dict> <key>com.apple.security.app-sandbox</key> <true/>
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>com.apple.finder</string>
<string>com.apple.systemevents</string>
<string>com.apple.FontBook</string>
<string>com.microsoft.Word</string>
</array>
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.FontBook</key>
<string>com.apple.FontBook</string>
</dict>
</dict>
<key>NSAppleEventsUsageDescription</key>
<string>Please give Unread Mail access to Mail via Apple Script.</string>
com.apple.security.app-sandbox
com.apple.security.network.client
com.apple.security.network.server
com.apple.security.temporary-exception.apple-events
com.apple.finder
com.apple.systemevents
com.apple.FontBook
com.microsoft.Word
com.apple.security.scripting-targets
com.apple.FontBook
com.apple.FontBook
并在Info.plist中添加以下内容:
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>com.apple.finder</string>
<string>com.apple.systemevents</string>
<string>com.apple.FontBook</string>
<string>com.microsoft.Word</string>
</array>
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.FontBook</key>
<string>com.apple.FontBook</string>
</dict>
</dict>
<key>NSAppleEventsUsageDescription</key>
<string>Please give Unread Mail access to Mail via Apple Script.</string>
nsappleeventsagedescription
请通过Apple脚本为未读邮件提供邮件访问权限。
在软件安装过程中执行此操作(安装程序被授予运行此类脚本的权限,否则将向用户请求授权)。或者,您可以将字体放在您的资源中并从那里使用。应用程序本身在使用自定义字体方面没有问题,但我的问题是如何将这些自定义字体用于在用户MacOS上运行的所有已安装应用程序您有什么问题?是关于运行AppleScript scrit的吗?还是关于安装字体?“我已经尝试了此链接中的大多数建议解决方案”哪些以及如何!?当尝试从我的应用程序运行AppleScript时失败,并显示以下消息:NSAppleScriptErrorBriefMessage-无权将Apple事件发送到Font Book。尽管在脚本编辑器中运行apple脚本,但在软件安装过程中,脚本仍会成功运行(安装程序被授予运行此类脚本的权限,或者它将向用户请求授权)。或者,您可以将字体放在您的资源中并从那里使用。应用程序本身在使用自定义字体方面没有问题,但我的问题是如何将这些自定义字体用于在用户MacOS上运行的所有已安装应用程序您有什么问题?是关于运行AppleScript scrit的吗?还是关于安装字体?“我已经尝试了此链接中的大多数建议解决方案”哪些以及如何!?当尝试从我的应用程序运行AppleScript时失败,并显示以下消息:NSAppleScriptErrorBriefMessage-无权将Apple事件发送到Font Book。尽管在脚本编辑器中运行apple脚本,但脚本仍能成功运行