swift - 使用 Xcode - 安装自定义字体以供 mac 中的所有应用程序使用
问题描述
我正在尝试使用 AppleScript 安装字体。该脚本运行成功,它从脚本编辑器安装了字体,但是当尝试从我的应用程序运行时,它失败并显示以下消息:
NSAppleScriptErrorBriefMessage - 无权将 Apple 事件发送到 Font Book。
我已经尝试了来自此链接的大多数建议解决方案: How to run an AppleScript from a sandboxed application on a Mac (OS X),但它不起作用。
以下是文件 App.entitlements 的内容:
<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>
并在 Info.plist 中添加以下内容:
<key>NSAppleEventsUsageDescription</key>
<string>Please give Unread Mail access to Mail via Apple Script.</string>
解决方案
推荐阅读
- spring - 多模块 maven 项目 - 将一个模块用作依赖项
- javascript - Javascript 意外令牌
- android - 任务':android:validateSigningDebug'执行失败:as_sys_sec_alg_ideaCBC
- java - java:抽象方法并使用 JUnit 测试对其进行测试
- c - Spı sck 引脚始终为高电平
- javascript - 为什么 EJS 会在 forEach 循环的每次迭代之间生成空格?
- .net - .Net核心外部登录在chrome上不起作用
- flutter - 在 dart 中动态定义或转换变量类型
- python - 如何禁用无头 chrome 中的弹出窗口?
- php - Bootstrap 模态表单不会在提交时关闭