我正在开发一个FinderSync扩展,我在检查选择是否正在选择,或选择/取消选择扩展时遇到一些问题.
有没有办法以编程方式检查是否FinderSync选择了扩展名System Preferences->Extensions?
当此选择发生变化时,是否有任何API可以获得通知?
除了使用以下内容之外,是否有任何API可以选择/取消选择扩展名?
system("pluginkit -e use -i com.mycompany.finderExt")
Run Code Online (Sandbox Code Playgroud)
请注意,我已经访问过这些页面:
我的 macOS 应用程序有一个通知服务扩展。
这是该扩展的代码:
import UserNotifications
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
print("Extension received notification!")
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
bestAttemptContent?.title = "Title modified!"
}
override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push …Run Code Online (Sandbox Code Playgroud)