【问题标题】:missing some urls in open with feature in swift在 swift 中使用功能打开时缺少一些 url
【发布时间】:2022-10-18 14:19:55
【问题描述】:
   func application(_ application: NSApplication, open urls: [URL]) {
        // got urls here
        NotificationCenter.default.post(name: Notification.Name("urlsFromOpenWithMenu"), object: nil , userInfo: ["Urls" : urls])
        print(urls)
    }

上面的代码没有使用 open with 功能打开所有 url。如果我使用 open with 打开应用程序并选择 png 文件和锁定文件和 zip 文件,它也不接受锁定文件和 zip 文件。

【问题讨论】:

  • 您的应用程序是 png、lock 和 zip 文档类型吗? application(_:open:) 是否使用不同的文件多次调用?
  • 是的,它多次调用并多次发出通知。

标签: swift macos appdelegate


【解决方案1】:

这一定是您的逻辑检查中的问题。

【讨论】:

    猜你喜欢
    • 2012-06-12
    • 1970-01-01
    • 1970-01-01
    • 2012-06-20
    • 2019-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多