相关疑难解决方法(0)

FinderSync检查是否选择了扩展名

我正在开发一个FinderSync扩展,我在检查选择是否正在选择,或选择/取消选择扩展时遇到一些问题.

有没有办法以编程方式检查是否FinderSync选择了扩展名System Preferences->Extensions

当此选择发生变化时,是否有任何API可以获得通知?

除了使用以下内容之外,是否有任何API可以选择/取消选择扩展名?

system("pluginkit -e use -i com.mycompany.finderExt")
Run Code Online (Sandbox Code Playgroud)

请注意,我已经访问过这些页面:

如何在Cocoa中的系统首选项中启用FinderSync扩展 - 目标C

OSX Finder同步扩展

macos objective-c system-preferences findersync

6
推荐指数
1
解决办法
726
查看次数

未使用 macOS 通知服务扩展

我的 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)

macos notifications unnotificationserviceextension

6
推荐指数
1
解决办法
1400
查看次数